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

From: mengx@...
Date: 2000-04-07 19:15:55 UTC
List: ruby-talk #2382
> 
>  result = FibGen.new(20).collect
> 
If I understood correctly, you could use  'iterator?' to
return the array directly. Or best of all, not to use iterator style
method at all :-). I do not like iterators (except for callback).
I prefer to use different methods to generate different sequences
and use for loop to get things done. I also noticed that iterators
are consistently slower(at least 5%) than a for loop.

-Ted

In This Thread

Prev Next