Florian Frank wrote:
> Hi!
> 
> (0..9).partition_by { |x| x % 3 }
>     ==>{0=>[0, 3, 6, 9], 1=>[1, 4, 7], 2=>[2, 5, 8]}
> 
> ["abc","defg","123","a","xyz","mnop"].partition_by { |x| x.size }
>     ==>{1=>["a"], 3=>["abc", "123", "xyz"], 4=>["defg", "mnop"]}
> 
> ["abc","bcd","abcde","cdef","bc","abcdef"].partition_by { |x| x[0] }
>     ==>{99=>["cdef"], 97=>["abc", "abcde", "abcdef"], 98=>["bcd", "bc"]}
> 
> What do you think?

We have a method just like that in JRuby, which we use a lot internally.
But we've named it "group_by", inspired by SQL.

/Anders
-- 

A n d e r s  B e n g t s s o n  |  ndrsbngtssn / yahoo.se
Stockholm, Sweden               |

_____________________________________________________
F?lj VM p? n?ra h?ll p? Yahoo!s officielle VM-sajt www.yahoo.se/vm2002
H?ll dig ajour med nyheter och resultat, med vinnare och f?rlorare...