An monotonically increasing set of Tuples.
There are three stages in the lifecycle of a tuple:
1. A tuple is added to this.toAdd, but is not yet visible externally. 2. Newly added tuples are then promoted to this.recent for one iteration. 3. After one iteration, recent tuples are moved to this.stable for posterity.
Each time this.changed() is called, the recent relation is folded into stable, and the toAdd relations are merged, potentially deduplicated against stable, and then made recent. This way, across calls to changed() all added tuples are in recent at least once and eventually all are in stable.
A Variable may optionally be instructed not to de-duplicate its tuples, for reasons of performance. Such a variable cannot be relied on to terminate iterative computation, and it is important that any cycle of derivations have at least one de-duplicating variable on it. TODO: tuple should be constrainted to something with Key/Value.
Convenient alias to retrieve the tuple type.
Consumes the variable and returns a relation.
Adds tuples from input1 whose key is not present in input2.
Adds tuples that result from joining input1 and input2.
Adds tuples that result from mapping input.
Inserts a relation into the variable.
Should the variable be maintained distinctly.
Used for testing purpose to ensure both paths produce the same result.
A useful name for the variable.
A list of recent tuples, still to be processed.
A list of relations whose union are the accepted tuples.
A list of future tuples, to be introduced.
Reports whether the variable has changed since it was last asked.