Sun Mar 10 12:54:53 EDT 2013
Support for piecewize time processing
Current semantics is reflected best in the t-lambda form.
(a b c d e f)
(v0 v1 N)
((v18 0) (v19 0))
(v2 v3 M)
((v12 0) (v13 0))
(((v4) (p_mul sx c))
((v5) (p_mul sy d))
((v6) (p_add v4 v5))
((v7) (p_add v6 a))
((v8) (p_mul sx e))
((v9) (p_mul sy f))
((v10) (p_add v8 v9))
((v11) (p_add v10 b))
((v14) (p_add v12 v7))
((v15) (p_add v13 v11)))
(values v14 v15))))
((v20) (p_add v18 v16))
((v21) (p_add v19 v17)))
(values v20 v21)))))
(t-values (v7 v11) (v22 v23))))
Essentially, this is stil a functional program, which has two
isomorphic interpretations related through the scalar <-> stream lift:
- Original stream->stream map with the shifted state i/o stream relation made explicit
- Scalar interpretation for elements of the stream.
The looped scalar interpretation is an implementation of the stream semantics.
The move from functional -> imperative is possible due to causality of
Now, I'd like to extend this to the following operational (imperative)
interpretation: some scalar code needs to run before the scalar loop
code runs. The type of the code is:
(si i) -> si'
Based on inputs, modify the algorithm state, and pass this state to
the loop. Since it runs only once per loop, it doesn't fit in the
original semantics. An operator (magic wand) needs to be introduced
for this. Also, the problem is: where to define? This should
probably be at the point of ai-feedback: add some state-massaging
operations which then can be moved up the chain.