import { type Reducer } from "https://deno.land/x/rimbu@1.2.0/core/mod.ts";
const { Impl } = Reducer;
The Implementation interface for a Reducer
, which also exposes the internal state type.
Properties
A function that produces the initial state value for the reducer algorithm.
Methods
Returns the next state based on the given input values:
Returns the output value based on the given state
.
Returns a Reducer
instance that only passes values to the reducer that satisy the given pred
predicate.
Returns a Reducer
instance that converts its input values using given mapFun
before passing them to this reducer.
Returns a Reducer
instance that converts each output value from some source reducer into an arbitrary number of output values
using given flatMapFun
before passing them to this reducer.
Returns a Reducer
instance that converts or filters its input values using given collectFun
before passing them to the reducer.
Returns a Reducer
instance that converts its output values using given mapFun
.
Returns a Reducer
instance that takes at most the given amount
of input elements, and will ignore subsequent elements.
Returns a Reducer
instance that skips the first given amount
of input elements, and will process subsequent elements.
Returns a Reducer
instance that takes given amount
of elements starting at given from
index, and ignores other elements.
Returns an 'AsyncReducerinstance that produces at most
amount` values.
Returns a 'Reducerinstance that produces until the given
pred` predicate returns true for
the output value.
Returns a Reducer
instance that first applies this reducer, and then applies the given next
reducer to each output produced
by the previous reducer.
Returns a reducer that applies the given nextReducers
sequentially after this reducer
has halted, and moving on to the next provided reducer until it is halted. Optionally, it provides the last output
value of the previous reducer.
Returns a 'runnable' instance of the current reducer specification. This instance maintains its own state and indices, so that the instance only needs to be provided the input values, and output values can be retrieved when needed. The state is kept private.