Most consumers of Scan don't care about the type of the type State type variable.
Most consumers of Scan don't care about the type of the type State type variable. But for those that do, we make an effort to expose it in all of our combinators.
The trivial scan that always returns the same value, regardless of input
A scan which, when given [a_1, ..., a_n]
outputs [c_1, ..., c_n]
where
c_i = initState + aggregator.prepare(a_1) + ... + aggregator.prepare(a_i)
A scan which, when given [a_1, ..., a_n]
outputs [c_1, ..., c_n]
where
c_i = monoidAggregator.monoid.zero + aggregator.prepare(a_1) + ... + aggregator.prepare(a_i)
A Scan whose Nth
output is the number N
(starting from 0).
Scans take streams of inputs to streams of outputs, but some scans have trivial inputs and just produce a stream of outputs.
Scans take streams of inputs to streams of outputs, but some scans have trivial inputs and just produce a stream of outputs. Streams can be thought of as being a hidden state that is queryable for a head element, and another hidden state that represents the rest of the stream.
The hidden state of the stream that we are turning into a Scan.
The type of the elments of the stream that we are turning into a Scan
The initial state of the scan; think of this as an infinite stream.
This function decomposes a stream into the its head-element and tail-stream.
A Scan whose inputs are irrelevant, and whose outputs are those that we would get from implementing a stream using the information provided to this method.
A call-by-name method that allocates new mutable state
A function that both presents the output value, and has the side-effect of updating the mutable state
A Scan that safely encapsulates state while it's doing its thing.