Expand description
Iterative application of a differential dataflow fragment.
The iterate operator takes as an argument a closure from a differential dataflow collection
to a collection of the same type. The output collection is the result of applying this closure
an unbounded number of times.
The implementation of iterate does not directly apply the closure, but rather establishes an
iterative timely dataflow subcomputation, in which differences circulate until they dissipate
(indicating that the computation has reached fixed point), or until some number of iterations
have passed.
Note: The dataflow assembled by iterate does not automatically insert consolidate for
you. This means that either (i) you should insert one yourself, (ii) you should be certain that
all paths from the input to the output of the loop involve consolidation, or (iii) you should
be worried that logically cancelable differences may circulate indefinitely.
§Details
The iterate method is written using a Variable, which lets you define your own iterative
computations when iterate itself is not sufficient. This can happen when you have two
collections that should evolve simultaneously, or when you would like to rotate your loop and
return an intermediate result.
Using Variable requires more explicit arrangement of your computation, but isn’t much more
complicated. You must define a new variable from an existing stream (its initial value), and
then set it to be a function of this variable (and perhaps other collections and variables).
A Variable dereferences to a Collection, the one corresponding to its value in each iteration,
and it can be used in most situations where a collection can be used. The act of setting a
Variable consumes it and returns the corresponding Collection, preventing you from setting
it multiple times.
Structs§
- Semigroup
Variable - A recursively defined collection that only “grows”.
- Variable
- A recursively defined collection.