import { Stream } from "https://deno.land/x/rimbu@0.14.0/stream/mod.ts";
Interfaces
A non-empty and possibly infinite sequence of elements of type T. See the Stream documentation and the Stream API documentation |
import { type Stream } from "https://deno.land/x/rimbu@0.14.0/stream/mod.ts";
A possibly infinite sequence of elements of type T. See the Stream documentation and the Stream API documentation
Examples
Example 1
Example 1
const s1 = Stream.empty<number>()
const s2 = Stream.of(1, 3, 2)
const s3 = Stream.range({ start: 10, amount: 15 })
Methods
Returns true if the sequence of elements in this stream are equal to the sequence in the other
stream according to the provided eq
function.
Returns the stream as a non-empty instance.
Returns the current stream preceded by the given value
Returns the current stream succeeded by the given value
Performs given function f
for each element of the Stream, using given state
as initial traversal state.
Performs given function f
for each element of the Stream, with the optionally given args
as extra arguments.
Returns a Stream where each element in this Stream is paired with its index
Returns a Stream where mapFun
is applied to each element.
Returns a Stream where the given mapFun
is applied to each value in the stream, with optionally
as extra arguments the given args
.
Returns a Stream consisting of the concatenation of flatMapFun
applied to each element.
Returns a Stream consisting of the concatenation of flatMapFun
applied to each element, zipped with the element that was provided to the function.
Returns a Stream consisting of the concatenation of StreamSource elements resulting from applying the given reducer
to each element.
Returns a Stream containing only those elements from this Stream for which the given pred
function returns true.
Returns a Stream containing only those elements from this Stream for which the given pred
function returns false.
Returns a Stream containing only those elements from this Stream for which the given pred
function returns true.
Returns a Stream containing only those elements from this Stream for which the given pred
function returns false.
Returns a Stream containing the resulting elements from applying the given collectFun
to each element in this Stream.
Returns the first element of the Stream, or a fallback value (default undefined) if the Stream is empty.
Returns the last element of the Stream, or a fallback value (default undefined) if the Stream is empty.
Returns the first element of the Stream if it only has one element, or a fallback value if the Stream does not have exactly one value.
Returns the amount of elements that are equal according to the given eq
to the given value
in the Stream.
Returns the amount of elements that are not equal according to the given eq
to the given value
in the Stream.
Returns the first element for which the given pred
function returns true, or a fallback value otherwise.
Returns the element in the Stream at the given index, or a fallback value (default undefined) otherwise.
Returns a Stream containing the indices of the elements for which the given pred
function returns true.
Returns a Stream containing the indicies of the occurrance of the given searchValue
, according to given eq
function.
Returns the index of the given occurrance
instance of the element in the Stream that satisfies given pred
function,
or undefined if no such instance is found.
Returns the index of the occurrance
instance of given searchValue
in the Stream, using given eq
function,
or undefined if no such value is found.
Returns true if any element of the Stream satifies given pred
function.
Returns true if every element of the Stream satifies given pred
function.
Returns true if the Stream contains given amount
instances of given value
, using given eq
function.
Returns true if this stream contains the same sequence of elements as the given source
,
false otherwise.
Returns a Stream that contains the elements of this Stream up to the first element that does not satisfy given pred
function.
Returns a Stream that contains the elements of this Stream starting from the first element that does not satisfy given pred
function.
Returns a stream that contains the elements of this Stream up to a maximum of amount
elements.
Returns a stream that skips the first amount
elements of this Stream and returns the rest.
Returns a Stream that returns the elements from this Stream given amount
of times.
Returns a Stream containing the elements of this Stream followed by all elements produced by the others
array of StreamSources.
Returns the mimimum element of the Stream according to a default compare function, or the provided otherwise
fallback value if the
Stream is empty.
Returns the mimimum element of the Stream according to the provided compare
function, or the provided otherwise
fallback value
if the Stream is empty.
Returns the maximum element of the Stream according to a default compare function, or the provided otherwise
fallback value if the
Stream is empty.
Returns the maximum element of the Stream according to the provided compare
function, or the provided `otherwise fallback value
if the Stream is empty.
Returns a Stream with all elements from the given sep
StreamSource between two elements of this Stream.
Returns a string resulting from converting each element to string with options.valueToString
, interspersed with options.sep
, starting with
options.start
and ending with options.end
.
Returns a Stream starting with options.sep
, then returning the elements of this Stream interspersed with options.sep
, and ending with
options.end
.
Returns a Stream of arrays of Stream elements, where each array is filled with elements of this Stream up to the next element that
satisfies give function pred
.
Returns a Stream of arrays of Stream elements, where each array is filled with elements of this Stream up to the next element that
equals given sepElem
according to the given eq
function.
Returns a Stream containing non-repetitive elements of the source stream, where repetitive elements
are compared using the optionally given eq
equality function.
Returns a Stream containing windows
of windowSize
consecutive elements of the source stream, with each
window starting skipAmount
elements after the previous one.
Returns the value resulting from applying the given the given next
function to a current state (initially the given init
value),
and the next Stream value, and returning the new state. When all elements are processed, the resulting state is returned.
Returns a Stream containing the values resulting from applying the given the given next
function to a current state (initially the given init
value),
and the next Stream value, and returning the new state.
Applies the given reducer
to each element in the Stream, and returns the final result.
Returns a Stream where the given reducer
is applied to each element in the Stream.
Returns a tuple where each tuple element corresponds to result of applying all Stream elements to the corresponding Reducer
instance of
the given reducers
.
Returns a Stream of tuples where each tuple element corresponds to result of applying all Stream elements to the corresponding Reducer
instance of
the given reducers
. Returns one element per input Stream element.
Returns an Array containing all elements in the Stream.
import { Stream } from "https://deno.land/x/rimbu@0.14.0/stream/mod.ts";