From: Brian Candler Date: 2009-06-22T21:52:07+09:00 Subject: Re: regular expression gurus--help! Robert Dober wrote: > Who feels with me that allowing you to do > > coll.map( &:join ) > > but forbidding > > coll.map( &:join, ", " ) > > is a shame. I think it's pretty ugly - especially the fact that you need the argument ", " to be passed to join, not to map, and yet it appears in map's argument list. > Now it is clear that the above is not correct Ruby syntax. From my > experience very few people are fond of > the magic dot, which would solve the problem elegantly. > > coll.map.join( ", " ) > > although in a very condensed way. 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. -- Posted via http://www.ruby-forum.com/.