Class

Scan

Running-aggregation iterator. For a source `[s_0, s_1, …, s_{n-1}]`, evaluates `initialState` once at scan start to seed the accumulator, then evaluates `accumulate` once per element with `stateVar` bound to the running accumulator and `elementVar` bound to the current element. The body's result is BOTH emitted AND threaded as the next iteration's accumulator. Use for cumulative aggregations that windowing can't express: running sum / max / min, cumulative confidence shift, rolling state machines (where each step's output depends on the prior state), running deltas. Different shape from WindowedMap — Scan sees a *running aggregation*, WindowedMap sees a *window of elements*. Source of length 0 emits nothing (silent empty). `initialState` is evaluated once at scan start, not per-element — natural reduce semantic.

Subclass Of
List-Sourced Expression

Referenced by

Domain