Table of Contents

Method AccumLazy

Namespace
SodaFlow
Assembly
SodaFlow.dll

AccumLazy<T, TReturn>(Stream<T>, Lazy<TReturn>, Func<T, TReturn, TReturn>)

Accumulate on this stream, outputting the new state each time an event fires using a lazily evaluated initial state.

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

Parameters

s Stream<T>

The stream.

initialState Lazy<TReturn>

The lazily evaluated 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.