From: Daniel Berger Date: 2005-08-03T00:11:40+09:00 Subject: Re: my map vs. collect bone 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. That's a YP, not an MP. The same could be said of all aliases. > 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. I prefer "map" for two reasons. First, I come from a Perl background, which uses map, so it's familiar. Second, there's no "collecting" going on. The most typical use for map is to alter each of the elements in some way, i.e. to "map them to another value". > 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. Extremely unlikely. Code breakage everywhere. Regards, Dan