@dxos/compute - v0.16.0
    Preparing search index...

    Interface Reducer<S>

    A left fold over events in feed order; every view of a trajectory is one of these, so state after n + k events is step applied k times to the state after n, and a reader never has to start from the first event.

    interface Reducer<S> {
        fold?: (state: S, events: readonly Trajectory.Event[]) => S;
        initial: S;
        step: (state: S, event: Trajectory.Event) => S;
    }

    Type Parameters

    • S

    Hierarchy (View Summary)

    Index

    Properties

    Properties

    fold?: (state: S, events: readonly Trajectory.Event[]) => S

    Folds a batch at once, equal to stepping each event; lets a reducer copy its state once per batch rather than once per event, which keeps a long fold linear. The state passed in is never modified.

    initial: S
    step: (state: S, event: Trajectory.Event) => S