Table of Contents

Method Accum

Namespace
SodaFlow
Assembly
SodaFlow.dll

Accum<T, TReturn>(Stream<T>, TReturn, Func<T, TReturn, TReturn>)

Accumulate on this stream, outputting the new state each time an event fires.

public static Cell<TReturn> Accum<T, TReturn>(this Stream<T> s, TReturn initialState, Func<T, TReturn, TReturn> f)

Parameters

s Stream<T>

The stream.

initialState TReturn

The initial state.

f Func<T, TReturn, TReturn>

Function to apply to update the state. It can make FRP logic or use Sample<T>(Cell<T>), and this is then equivalent to snapshotting the cell with Snapshot<T, TResult>(Stream<T>, Cell<TResult>). Apart from this, the function must be pure.

Returns

Cell<TReturn>

A cell holding the accumulated state of this stream.

Type Parameters

T

The type of the stream.

TReturn

The type of the accumulated state.