On Mon, Jun 22, 2009 at 2:52 PM, Brian C.[email protected]
wrote:
Robert D. wrote:
That I dislike very much. What you want is to run a ‘join’ operation on
each member of the collection, but that looks like running a .map.join
on the whole collection. From that point of view,coll.map { |c| c.join(“,”) }
expresses very clearly what you’re doing.
I agree with you, that this is confusing at first sight, but actually
coll.map.join instead of coll.join does not make any sense at all.
My corollary is:
Any method sent to map makes only sense to be sent to the elements of
the collection and not
to the collection itself because that would make map a NOP.
I believe that the confusion arises from the fact that map returns an
Enumerator and that just seems quite flawed at second thought (or is
this third thought ;).
Why the heck does map return an Enumerator? If I wanted that I surely
would have called to_enum !
And if the receiver already was an Enumerator I want to call map for
some purpose too.
Strange that this has never occurred to me, alhough I always had this
flawed feeling about #map
This is a very strong opinion but it is hold, how does Rick say?,
loosely
Cheers
Robert
–
Toutes les grandes personnes ont d’abord été des enfants, mais peu
d’entre elles s’en souviennent.
All adults have been children first, but not many remember.
[Antoine de Saint-Exupéry]