Florian Frank wrote:
> On 2002-11-17 02:25:10 +0900, Yukihiro Matsumoto wrote:
> 
>>|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.
>>
>>I prefer "group_by" to "partition_by".  Could it be just "group",
>>since we have "select" not "select_by"?
> 
> 
> "group" or "group_by" is perhaps a better name, because it is shorter. I
> named the method "partition_by" because it is somehow related to
> "partition". The returned hash's values are a more general partition.
> 

This naming issue came up before (cf. http://ruby-talk.com/13548 ).

How about the following possibilities.

#multiplex - This one makes sense especially if one tends to choose a particular result:
["a","bb","ccc","dd","e","ff"].multiplex{|x| x.size}	#=>{1=>["a","e"],2=>["bb","dd","ff"],3=>["ccc"]}
["a","bb","ccc","dd","e","ff"].multiplex{|x| x.size}[2]	#=>["bb","dd","ff"]
It is similar to #select for a single case:
["a","bb","ccc","dd","e","ff"].select{|x| x.size==2}	#=>["bb","dd","ff"]

#multiselect - This one is reminiscent of #select, but has multiple results:
["a","bb","ccc","dd","e","ff"].multiselect{|x| x.size}	#=>{1=>["a","e"],2=>["bb","dd","ff"],3=>["ccc"]}

#assort - For this one, think "assorted sizes":
["a","bb","ccc","dd","e","ff"].assort{|x| x.size}	#=>{1=>["a","e"],2=>["bb","dd","ff"],3=>["ccc"]}


I think the best name just might be "assort" because all the possible elements
of the array are being grouped into separate compartments, which is what that means.

Main Entry: as?sort
Pronunciation: &-'sort
Function: verb
Etymology: Middle French assortir, from a- (from Latin ad-) + sorte sort
Date: 15th century
transitive senses
1 : to distribute into groups of a like kind : CLASSIFY
2 : to supply with an assortment (as of goods)
intransitive senses
1 : to agree in kind : HARMONIZE
2 : to keep company : ASSOCIATE
- as?sort?er noun



Guy N. Hurst