[ruby-talk:02377] Iterator into array

From: Clemens Hintze <c.hintze@...>
Date: 2000-04-07 17:16:49 UTC
List: ruby-talk #2377
Hi Dave,

sorry but I do not even understand your question. Could you explain
more a little bit?  What is 'iteratorMethod { |i| result << i }'
supposed to do?


\cle


Dave Thomas writes:
> 
> Dave's stupid question of the week:
> 
> Given an iterator method, how can I get the results expressed as an
> array? I could do:
> 
>   result = []
>   iteratorMethod { |i| result << i }
> 
> But this seems ugly - there must be a more functional way of doing this. Any
> ideas? 
> 
> 
> Dave
> 

-- 
Clemens Hintze  mailto: c.hintze@gmx.net

In This Thread