Fri Apr 16 15:33:04 EDT 2010
Should rv-force be private?
I.e. it is not allowed to ever "unpack" a reactive value, except at
the top-level = exit point / end point of the DAG.
I'm not sure how to express that yet, but what I do know is that an
unfold of an RV should be a list of RVs.
What I'm really looking for is a way to construct a collection of
computations that all depend on a single value: parse a file into a
list of articles, but make sure that when the file gets updated the
list gets re-computed.
The list can never be represented concretely (it's size is not known).
The best way to access it is abstractly through index functions.
This is an interesting problem.
Let's make it more concrete: how to abstract a list of reactive values
by a finite function that performs a lookup. The index will be
rebuilt whenever the file changes. Additionally, each result depends
on the input.
It seems simplest to abstract reactive collections as dictionaries
(define (rv-lookup rv-dict)
(let ((node (rv-delay (dict-ref (rv-force rv-dict) key))))
(rv-register-child! rv-dict node)
One problem: the result of a lookup is a freshly computed rv. Maybe
it's best to add caching here too, so the rvs are shared.
This needs a memo-function abstraction.
Seems to work, but how does this extra persistence behave in the face
of errors? RV's that where once defined but now trigger errors will
not be collected. I.e. this doesn't work for transient data.