In general Patterns are stateless. But e.g. for counted embedding in other Patterns the exception of stream-like behaviour is practical. PS might also be used in cases where Streams must not be passed to certain Patterns.
Creates a new PS object.
srcPat |
Source pattern, might also be event pattern. |
length |
Number of output items, may be pattern or stream, defaults to inf. |
bufSize |
Size of buffer to store last values, defaults to 1. |
copyItems |
Determines if and how to copy items, which are which are either non-Sets or member of Sets. Takes Integer 0 (or false or Symbol \false), 1 (or true or Symbol \true) or 2 (or Symbol \deep). Other values are interpreted as 0. Defaults to 0. 0: original item 1: copy item 2: deepCopy item |
copySets |
Determines if to copy Sets (and hence Events). Takes Integer 0 (or false or Symbol \false), 1 (or true or Symbol \true). Other values are interpreted as 0. Defaults to 1. 0: original Set 1: copy Set NOTE: The distinction of copying items and sets makes sense in the case of event streams. Per default Events are copied (copySets == 1), not their values (copyItems == 0). By playing Events those are used to store additional data (synth ids, msgFuncs …) which is mostly not of interest when refering to the event stream, e.g. with PSx patterns which use MemoRoutine - copied Events will not contain this additional data. If values of Events or values returned directly by the stream (being no kind of Sets) are unstructured then copying makes no sense, this is the normal case, so copyItems defaults to 0. When going to alter the ouput, you might want to set copyItems to 1 for a PSx returning simple arrays or 2 for nested arrays (deepCopy). For deepCopying Events you'd have to set copySets to 1 and copyItems to 2 (an option copySets == 2 doesn't exist as it would be contradictory in combination with copyItems < 2). NOTE: Copy options concern copying into PS's buffer as well as the output of a Stream derived from the PS. When such a Stream is outputting copies this prevents unintended altering of items from srcPat. On the other hand storing copies in PS's buffer prevents these from being altered unintendedly. |
Last value stored in memoRoutine
Array of last values stored in memoRoutine, latest value is first in array.
Returns ith item of array of last values stored in memoRoutine (keep in mind reversed order: last value first)
Size of array of last values.
Instance variable getter and setter methods.
Instance variable getter and setter methods.
Instance variable getter and setter methods.
Instance variable getter and setter methods.
Instance variable getter and setter methods. Counts each call of next / value / resume / run on the memoRoutine. If several Streams are derived from one PS each call of next on a derived Stream will be counted by the memoRoutine and thus by the PS.
Returns items of the array lastValues, but in the order in which they appeared, i.e. latest value is first in array.
dropNils |
Boolean. If dropNils is true (default), nils will be rejected from the array. |