From: Nicholas Milkovits Date: 2007-04-02T22:17:00+09:00 Subject: Re: Map Or Collect Redux I think the aliases are there for a good syntactic reason. It seems to me that if you are just filtering out items which meet a certain criteria from one array to be put into a new one (say all elements which are even numbers) then you are collecting. If you're actually performing a transformation on the elements then you are mapping one array space onto another. example arr = [1, 2, 3, 4, 5] arr.collect { |x| if x%2 == 0 then x end }.compact => [2, 4] # Seems like maybe it should be .filter instead of .collect arr = [1, 2, 3, 4, 5] arr.map { |x| x*2 } => [2, 4, 6, 8, 10] On 4/2/07, RubyTalk@gmail.com wrote: > Looking in the old archives of ruby-talk I found a thread in 2005 > about using map or collect. As far as I know there is not difference > between the two methods. I would like to know what everyone's > preference is? > > I like using collect. > > > Stephen Becker IV > >