From: "Brian Schröder" Date: 2005-08-03T01:12:55+09:00 Subject: Re: my map vs. collect bone On 02/08/05, Trans wrote: > I have a bone to pick. I tire of accounting for both method terms 'map' > and 'collect'. Anytime I create a method like #collect_with_counter I > feel obliged to create an alias #map_with_counter. And at this point my > collection of useful methods has a pretty good number of them. So my > feeling incerading become "This town's just not big enough for the both > of 'em". Besides its a waste of useful semanitic space. > > Now when it comes to choosing between the two, I'm go for 'collect' > because its meaning is clearer to me even though its not as concise. > To me 'map' indicates 'hash' and its a strech to think of the resulting > array as a map. I suppose 'map' indicates that an input element > coorepsonds a resulting output element --but still that's weak. Lots of > things fit that description, like methods. I suspect it was really just > borrowed from lisp. Anyhow I digress. > > The point is, can we just settle on one or the other for a future > version of Ruby? Although I prefer 'collect', I don't really care > which. Just pick one. > > T. > > > I never use collect, because collect would seem more like select or inject to me, while map makes it clear that the elements are mapped onto other elements. (Not so clear in general maybe, but clear enough to me ;) regards, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/