head() |
Returns the head of a Stream. |
tail() |
Returns the tail of a Stream. |
isEmpty() |
Checks if a Stream is empty. |
hasEmptyTail() |
Checks if the tail of a Stream is empty. |
append(s) |
Appends the stream s to the end of this stream. |
pick(n) |
Picks the first n elements out of a stream, terminates when it gets to the nth item or reaches the end of
the stream. |
elementAt(index) |
Returns the element at index in a stream. Returns undefined if stream size is less than the index. Indexing
is zero-based. |
length() |
Gets the length of a stream - only defined for finite streams. |
reduce(fn, initialValue) |
Reduces the stream to an accumulated value obtained over each stream element. Only valid for finite streams.. |
sum() |
Calculates the sum of the elements of a stream. |
map(stream, fn) |
Maps a function over all the elements of a stream. |
filter(fn) |
Filters a stream. |
contains(element) |
Check if the stream contains element. Only defined for a finite stream. |
walk(fn) |
Walks a stream and applies the input function to the stream. Stream has to be finite for this to work. |
print(n) |
Prints out the first n elements of a stream, will stop if stream length is less than n. |
remove(n) |
Removes the first n elements of a stream. Returns an empty stream if n is greater than the stream's
length.
|
toArray() |
Constructs an array containing the elements of a finite stream. |
add(s1, s2) |
Adds stream s1 to stream s2. |
zip([...streams]) |
Zips all elements of the input streams together. Works like Python's zip but returns arrays of arrays instead of
a list of tuples The nth entry of a zipped stream is an an array consisting of all the nth elements of its constituent
streams.
|
create([...values]) |
Creates an input stream using a list of arguments. |
fromArray(values) |
Creates an input stream from an array. |
fromInterval(low, high)() |
constructs a stream made up of consecutive numbers in the range [low high]. |
from(start) |
Constructs an infinite stream of consecutive numbers starting from integer start. |
upTo(stop) |
Constructs a stream made up of consecutive numbers up to stop. |
Ones() |
Returns an infinite stream of ones. |
NaturalNumbers() |
Returns the stream of Natural numbers. |