Sun Feb 21 09:12:02 CET 2010

Input / State / Output

Combinators for DSP.  Can the recursion operator be made explicit?
I.e. in the spirit of 1-pass code generation, how to encode the delay

Let's think about the eventual C code to make this more concrete.
Code eventually needs 3 dictionaries: input, state, output.

In C this needs a concrete representation.  It seems simplest to use
structs for this, like:

void process (struct ins *in, struct outs *out, struct states *state) {
     float r1 = in.bus0;
     float r2 = in.bus1;
     float r3 = r1 * r2;
     out.bus0 = r3;
     float r4 = state.z0;
     state.z0 = 0.9 * r3;

This interface is only for generated code.  The (compile-time) high
level objects should have a different composition mechanism though.
However, this can be completely defined in Haskell.  A lot is possible
here; it can be kept modular.

Todo: collect input, output, state variables during translation.