From: Robert Klemme Date: 2004-05-19T04:13:48+09:00 Subject: Re: RCR: More enumerator functionality "David A. Black" schrieb im Newsbeitrag news:Pine.LNX.4.44.0405181140170.1696-100000@wobblini... > Hi -- > > On Mon, 17 May 2004, Kristof Bastiaensen wrote: > > > 5.enum_filter(:times){ |i| i[0] == 0 }.collect > > => [2, 4] > > [...] > > > (2)* Enumerable::Enumerator takes a optional block > > > > powers = 4.enum_for(:times){ |i| i * i } > > powers.collect > > => [0, 1, 4, 9] > > Keep in mind rejected RCR #50 > (http://www.rcrchive.net/rgarchive/rejected.html#rcr50). It's perhaps > not identical to what you're proposing, but very similar. (It's > proposed as a modification of #map.) > > (Aside: collect without a block returns an array with the same > elements as the receiver, so there's probably no point calling it.) Probably #to_a would be clearer here. I guess the aim was to print an array from the Enumerator. robert