From: "Peña, Botp" Date: 2008-07-04T16:19:05+09:00 Subject: Re: thoughts on a more generic Array#partition function From: Yukihiro Matsumoto [mailto:matz@ruby-lang.org] # writes: # |current test: # | # |1.9 not sorted # |1.8.6 not sorted # |1.8.7 sorted # | # |i prefer 1.8.7 default behaviour # Hmm, from my understanding, 1.9 preserves the order, prior version # does not. Could you show us the test you got the above conclusion? sir Matz, as requested, > [RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_REVISION] => ["1.9.0", "2008-06-20", 17482] > RUBY_PLATFORM => "i386-mswin32" > a = [ 1, 2, 3, 4, 7, 9, 11, 12, 13, 14 ] => [1, 2, 3, 4, 7, 9, 11, 12, 13, 14] > a.group_by { |i| i % 3 } => {1=>[1, 4, 7, 13], 2=>[2, 11, 14], 0=>[3, 9, 12]} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ at this point, 1.9 and 1.8.7 differs > h=a.group_by { |i| i % 3 } => {1=>[1, 4, 7, 13], 2=>[2, 11, 14], 0=>[3, 9, 12]} > h.values => [[1, 4, 7, 13], [2, 11, 14], [3, 9, 12]] kind regards -botp