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.)


David

-- 
David A. Black
dblack / wobblini.net