>>to: limit byNext: streamOrCollection do: a1block
| each rs |
each := self.
rs := streamOrCollection readStream.
[ each <= limit
[ a1block value: each.
rs atEnd ifTrue: [rs reset].
each := each + rs next
You'll also need this one (which is missing in most st implementations)
and possibly this one
position := 0
(Is this for school? Be sure and check the results!)
On 10/13/2014 4:12 PM, Adam Crumpton wrote:
> instead of:
> 1 to: 100 by: 2 do: [:n | n doSomething ].
> I want to iterate over the numbers in an irregular way based on some
> sort of list or stream, like:
> 1 to: 100 byNext: #(1 2 3 4 5) do: [:n | Transcript show: (n
> printString), cr].
> and have it show:
> any suggestions on implentation would be appreciated. The list has to
> be of arbitrary length.
> Adam Crumpton
> vwnc mailing list
> [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >