Scan

See also

  • Official ReactiveX documentation: Scan
Observable.scan(accumulator, seed=None)

Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value. For aggregation behavior with no intermediate results, see Observable.aggregate.

1 - scanned = source.scan(lambda acc, x: acc + x) 2 - scanned = source.scan(lambda acc, x: acc + x, 0)

Keyword arguments: accumulator – An accumulator function to be invoked on each element. seed – [Optional] The initial accumulator value.

Returns an observable sequence containing the accumulated values.

../../_images/scan.png