Sun Nov 20 09:17:51 EST 2011
Time to cut the knot.
Ok, day went by doing other stuff.. Can I tackle this now?
(s,i) -> (s,o) -> (rs,ri,ro) -> m ()
Convert a system into something that binds to state, input and output
references, where state is R/W, input is R and output is W.
This problem has been there for so long that I essentially started to
hate it :)
On the one end there's the unification based approach such as used in
Oz declarative programming. On the other hand there's the just take
that damn pointer and store it approach.
Let's look at Haskell's mutable arrays for inspiration. Interesting,
but brings nothing really. It has get and set...
This is really a non-problem.
1. It was good to solve the control flow problem. Now it's possible
to write loops in a functional style, i.e. where loop state
update doesn't need assignment.
2. The control flow problem has nothing to do with storing outputs
and final state though. It's a separate issue that has more to
do with the system we're embedding in (i.e. Pd).
Still... where to put 2?
Maybe I it should be mutable arrays? Think about it upside-down: the
MArray is an *interface* which can probably be made to cover both
sides: make a generic map that translates a system function to an
MArray update function, and implement MArray for the Term / C target.
This should then allow to run tests in Haskell on IO or ST arrays.
in: (s,i) -> (s,o)
out: (as,ai,ao) -> m r
dimension info for low-level implementation
where 'r' is some analysis variable, i.e. output array, or () for side
effect only (recording / playback).