I'm pretty happy just iterating and using <<. I'm not sure there's a
need to wrap it in another method.
David
···
On Thu, 2 Oct 2008, Robert Klemme wrote:
On 01.10.2008 18:17, David A. Black wrote:
It doesn't; I'm just using it to separate the collection and a
potential "mapping".[1,2,3,4,5].map("") {...} # Result: "Hi."
I don't think that << correctly represents the concept of mapping, so
I would not want map to be generalized to any <<-capable target
object. It's more a <<'ing, or something, than a mapping. It happens
that the current behavior of map can be implemented using << and an
empty array, but I don't think that means that << per se is at the
heart of mapping.Ah, now I get your point. Thanks for elaborating. So you'd rather call such a method #append or similar.
--
Rails training from David A. Black and Ruby Power and Light:
Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL
Advancing with Rails January 19-22 Fort Lauderdale, FL *
* Co-taught with Patrick Ewing!
See http://www.rubypal.com for details and updates!