Sun Jan 27 19:21:57 CET 2013
State threading context needs to be explicit.
What is currently missing is the "end point" of state feedback.
I.e. it is assumed that the "context" is stream processing.
Basically, this needs to be made symmetric:
`feedback' refers to an environment that collects all the threaded
state introduced during execution.
It needs to be delimited. This is a bit like a prompt or continuation
Summary: move from the idea that streams are "global" to "local".
The misleading part is that the engineering context is a "global"
stream that is essentially "open". There is no begin (technically
there is: state initialized to 0) but there is no end: only the I/O is
of importance. However, for "local streams", the end state might be
the only thing we're interested in, i.e. a fold.
Such operations need to be localized, such that they look like pure
function evaluations on the outside.
Also important: this implicit "feedback" trick is *different* from
ordinary for/fold! It is a syntactic trick to ease notation.
This is how it should be made explicit:
(loop ((s1 0) ;; state
((i0 (in S0)) ;; streams
(i1 (in S1))
(i2 p2)) ;; parameter
... ;; explicit bindings
(values s1+ s2+ ;; state
o0 ...) ;; output streams
The above would be the expansion of:
(begin-feedback ((i0 (in S0))
(i1 (in S0)))
... ;; implicit bindings
(values o0 ...))
So let's do this first.