Clemens Hintze <c.hintze / gmx.net> writes:

> But I could not imagine how it should work! Look onto your 'fibUpTo'
> method. It returns nothing. From where should the values you want to
> have come from?

My suggestion (actually, it's less than a suggestion, it's really just a 
wild idea) is that the values passed to 'yield' could be collected in
to an array in the cases where an iterator was called without a
block. In this case, the values passed to yield (the Fibonacci numbers 
in this case) would be collected, so the method would return an array
of them. In another post, I suggested a disambiguation in the calling
syntax to make this possible without breaking other code.

Anyway, ny initial post was the question: is there a neat, functional
way to collect the values yielded by an iterator, and it seems like
the answer is (sadly) no.

Regards


Dave