[Function]
(next pattern [length])

Returns one or more elements from pattern according to length. If length is not specified or false then just the next element from pattern is returned. If length is a number then that many elements are read from the pattern and returned in a list. Otherwise if length is not false then the next chunk chunk of data is read from the pattern according to the period length of the pattern.

cm> (define x (new cycle :of '(a b c d) ))

cm> (next x)
a
cm> (next x)
b
cm> (next x 6)
(c d a b c d)
cm> (next x :chunk)
(a b c d)
cm>

See Also: