co.paralleluniverse.pulsar.dataflow
df-val
(df-val f)
(df-val)
Returns a val object that can be read with deref/@, and set,
once only, by applying the val as a function to the value.
Calls to deref/@ prior to delivery will block, unless the variant of deref with timeout is used.
All subsequent derefs will return the same delivered value without
blocking.
Attempting to assign a value to the val more than once will result in an IllegalStateException
See also - realized?.
df-var
(df-var history f)
(df-var history-or-f)
(df-var)
Returns a var, a variable whose value can be set multiple times and by multiple strands, and whose changing values can
be monitored and propagated.
The var's value is read with deref/@. That returns the var's current value,
or, more precisely: it returns the oldest value in the maintained history that has not yet been returned in the calling strand,
unless this Var does not yet have a value; only in that case will this method block until it is set for the first time.
The var's value is set by applying the var as a function to the value.
The var can also be set by providing a formula function, whose return value will set the var's value.
If the function dereferences other vars (or vals), any change to them will recompute the function and re-set this var's value.
history - how many historical values to maintain for each strand reading the var
f - this var's formula function