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

From: Dave Thomas <Dave@...>
Date: 2000-04-08 15:13:52 UTC
List: ruby-talk #2401
matz@netlab.co.jp (Yukihiro Matsumoto) writes:

> But fibUpTo() has its return value, which happens to be meaningless
> for this method, other than yielded values.  So it may be better that: 
> 
>   fibUpTo(20)   ->  nil/[1,1,2,3,5,8,13]
> 
> In addition, not all blocks are used for iteration.  For example,
> how do you think the following should be documented?
> 
>   [4,2,4,5].sort  -> [2,4,4,5]/[[4, 4],[4, 5],[2, 4],[4, 2]]?

Agreed, which is why we'd need a new syntax to distinguish the
uses. (I'm beginning to regret having started this thread ;-).

After all this, I still feel that we haven't yet seen a nice way to
achieve the original objective: populating an array from the multiple
results of an iterator.


Dave

In This Thread

Prev Next