From: Robert Klemme Date: 2004-01-15T02:41:37+09:00 Subject: Re: [OT] Re: collect! and Enumerable "Mauricio Fern�ndez" schrieb im Newsbeitrag news:20040114161617.GA20817@student.ei.uni-stuttgart.de... > On Thu, Jan 15, 2004 at 01:11:41AM +0900, Robert Klemme wrote: > > > Does collect! (or map!) make sense for Enumerables? Keep in mind that > > > collect! (aka map!) is defined in Array. > > > I guess you could define it as > > > module Enumerable > > > def collect!(&b) > > > to_a.collect!(&b) > > > end > > > end > > > but I don't feel too bad about having to do to_a explicitly. > > > > Especially since your definition of collect! would defy users' > > expectations that it would do it in place while it really creates a copy. > > :-) > > that's why "Does collect! (or map!) make sense for Enumerables?", > but you expressed it so much better ;-) Err, no. Apparently you wanted to say the same as I did but I was tricked into believing something else by "I guess you could define it as ...". Sounded like a positive suggestion to me. Now, who said English was easy? :-) Kind regards robert