Next: , Up: Generator   [Index]

1.85.1 Generator class: instance creation

inject: aValue into: aBlock

Return an infinite generator; the first item is aValue, the following items are obtained by passing the previous value to aBlock.

on: aBlock

Return a generator and pass it to aBlock. When #next is sent to the generator, the block will start execution, and will be suspended again as soon as #yield: is sent from the block to the generator.

on: aCollection do: aBlock

Return a generator; for each item of aCollection, evaluate aBlock passing the generator and the item.