import { type Reducer } from "https://deno.land/x/rimbu@1.2.1/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 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 that applies this reducer and then the nextReducers
sequentially on halting of each reducer.
It provides the last output value of the active 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.