JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6048

Array#repeated_permutation(n) enumerates nothing when n is greater than the length

    Details

    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      $ ruby -ve 'p [1,2].repeated_permutation(3).to_a'
      ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
      [[1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 2, 2], [2, 1, 1], [2, 1, 2], [2, 2, 1], [2, 2, 2]]

      $ jruby --1.9 -e 'p [1,2].repeated_permutation(3).to_a'
      []

      A patch is attached.

      FYI, I found this bug by executing CRuby's test/ruby/test_array.rb
      In fact, it DOES run, though it emits many errors/failures because of
      JRuby's lack of support for $SAFE, full continuation, auto-synchronized
      array, etc.


      Yusuke Endoh <mame@tsg.ne.jp>

        Activity

        Hide
        Martin Harriman added a comment -

        The rubyspec test suite fails on this as well: rubyspec/core/array/repeated_permutation_spec.rb

        ruby-doc includes this as one of the examples for repeated_permutation.

        Show
        Martin Harriman added a comment - The rubyspec test suite fails on this as well: rubyspec/core/array/repeated_permutation_spec.rb ruby-doc includes this as one of the examples for repeated_permutation.
        Hide
        Hiro Asari added a comment -

        Endoh-san,

        Can we have a patch with the email address, etc., so that I can apply (and test) it? As is, git bails on me as follows:

        $ git am --signoff < ~/Downloads/repeated_permutation.patch
        Patch does not have a valid e-mail address.
        

        Thanks.

        Show
        Hiro Asari added a comment - Endoh-san, Can we have a patch with the email address, etc., so that I can apply (and test) it? As is, git bails on me as follows: $ git am --signoff < ~/Downloads/repeated_permutation.patch Patch does not have a valid e-mail address. Thanks.
        Hide
        Hiro Asari added a comment -

        I fixed this recently without the benefit of the attached patch. (I had completely forgotten about this ticket when I fixed it.)

        https://github.com/jruby/jruby/commit/a1f43c08341de994bea1b01041f91ee76eb9d783

        Show
        Hiro Asari added a comment - I fixed this recently without the benefit of the attached patch. (I had completely forgotten about this ticket when I fixed it.) https://github.com/jruby/jruby/commit/a1f43c08341de994bea1b01041f91ee76eb9d783

          People

          • Assignee:
            Hiro Asari
            Reporter:
            Yusuke Endoh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: