R
Robert Dober
Robert Dober 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
--=20
Toutes les grandes personnes ont d=92abord =E9t=E9 des enfants, mais peu
d=92entre elles s=92en souviennent.
All adults have been children first, but not many remember.
[Antoine de Saint-Exup=E9ry]