On 4/2/07, RubyTalk / gmail.com <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 use map for the most part - the one place I occasionally use collect
is when I'm mapping over a struct or class to pick out a few fields,
e.g.

books.collect {|b| [b.author, b.title]}

If I were designing my own language, I'd have map be
structure-preserving, and collect return an array, but that's just my
personal feeling.

martin