Create a sequence that is the infinite repetition of a series of values.
constsequence:Seq<string> =cycle(["a","b","c"])
typecycle= <T>(items:T[]) =>Seq<T>
repeat
Create a sequence which repeats the same value X number of times. The length of the sequence defaults to Infinity.
// Creates a sequence of 5 true values.constsequence:Seq<boolean> =repeat(true,5)
// Creates a sequence of 0 which repeats infinitely.constsequence:Seq<number> =repeat(0)
typerepeat= <T>(value:T, times =Infinity) =>Seq<T>
repeatedly
Creates a sequence which pulls from an impure callback to generate the sequence. The second parameter can cap the length of the sequence. By default, it will call the callback infinitely to generate values. Useful for asking about current time or cache values.
typerepeatedly= <T>(value: () =>T, times =Infinity) =>Seq<T>
empty
A sequence with nothing in it. Useful as a "no op" for certain code-paths when joining sequences together.
constsequence:Seq<never> =empty()
typeempty= () =>Seq<never>
zip
Takes two sequences and lazily combines them to produce a tuple with the current step in each of the two positions. Useful for zipping a sequence of keys with a sequence of values, before converting to a Map of key to value.
Takes two sequences and lazily combines them to produce an arbitrary value by mapping the current value of the two positions through a user-supplied function. Useful for table (row/col) math.
Takes three sequences and lazily combines them to produce an arbitrary value by mapping the current value of the three positions through a user-supplied function.