#import <ToadGenerators.h>
Static Public Member Functions | |
(Generator) | + infiniteSequentialInts |
(Generator) | + rangeFrom:to: |
(Generator) | + NSArraySeq: |
(Generator) | + NSDictionarySeq: |
(Generator) | + Primes |
Generators are blocks that provide the original source of data for the transformations.
Each block is of the form ^id(BOOL *end). Each time they are called they will return the next value in the sequence and will set *end to be NO. When they have run out of data they will set *end to be YES. They should also return nil - although this should not be relied on.
Note that not all generators will end. For example to infiniteSequentialInts will carry on (its behaviour will be undefined at MaxInt.) It is up to you to make sure you only take as many values as you need.
+ (Generator) infiniteSequentialInts |
Returns an infinite sequence of ints. Will be undefined when it gets to MaxInt. Note the sequence is of objects of type NSNumber. If you need to do arithmetic with the values then use the intValue property of the values.
+ (Generator) NSArraySeq: | (NSArray *) | arr |
Returns a sequence of the elements of the array.
arr | The array containing the elements to create the sequence from |
+ (Generator) NSDictionarySeq: | (NSDictionary *) | dict |
Returns a sequence of the keys of the dictionary.
dict | The dictionary |
+ (Generator) Primes |
Returns an infinite (subject to memory and time) sequence of prime numbers
+ (Generator) rangeFrom: | (int) | from | ||
to: | (int) | to | ||
Returns a seqence of integers between from and to.
from | Start the sequence from this number | |
to | End the sequence after the number. |