From: "Peña, Botp" Date: 2008-07-03T12:44:59+09:00 Subject: Re: thoughts on a more generic Array#partition function From: Rudi Cilibrasi [mailto:cilibrar@gmail.com] # Subject: thoughts on a more generic Array#partition function # .... # puts "\nSpecial (new extension) three-way list split" # testpart(a) { |i| i % 3 } how does it compare to #group_by > RUBY_VERSION => "1.9.0" > 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]} > RUBY_VERSION => "1.8.7" > 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 } => {0=>[3, 9, 12], 1=>[1, 4, 7, 13], 2=>[2, 11, 14]} kind regards -botp