[ruby-talk:02380] Re: Iterator into array

From: kjana@... (YANAGAWA Kazuhisa)
Date: 2000-04-07 18:29:49 UTC
List: ruby-talk #2380
In message <m2n1n5lwjf.fsf@zip.local.thomases.com>
Dave@thomases.com writes:

> Given an iterator method, how can I get the results expressed as an
> array? I could do:
> 
>   result = []
>   iteratorMethod { |i| result << i }

If your iterator is defined on a collection includes Enumerable
(eg. Array), you can use --- what is one subject these days ---
Enumerable#collect.  Or you prefer a method like Array#filter for its
effectiveness.

# Or do I miss the point?


-- 
kjana@os.xaxon.ne.jp                                  April 8, 2000
Dreams come true --- excepting yours.

In This Thread