From: Mike Austin <"mike[nospam]"@...> Date: 2008-12-01T12:39:38+09:00 Subject: Re: Enumerable#select used to return actual values Robert Dober wrote: > On Mon, Dec 1, 2008 at 12:24 AM, Yukihiro Matsumoto wrote: > >> #each_with_object is an interesting concept. Maybe we can add it to >> the Enumerable if we can come up with a better name. >> >> matz. > Maybe the difficulty to find a name points to a problem... > I was just thinking that this looks really cool > > [].with_each( 1..10 ){ |o, e| o << e if e > 5 } What about just "each_with()"? (1..10).each_with([]) { |o, e| o << e if e > 5 } It goes together well with "each_with_index()", imho. > What do you think, surely adding #with_each to #Object shall be very > carefully considered, but I like the syntax, err yes I have already > said that ;) > > Robert Mike