[<<][meta][>>][..]
Wed Jan 16 22:31:21 CET 2013

Simple AI tests

EVAL/SSA style AI is quite straightforward[1].

The real trick is to add state to the picture.  Here eval is over
(causal) streams, and code generation needs to take care of state
initialization and propagation.

Lets try that out.  The simplest way to try this out is using delay
which we call `z'.

How to implement?  Let's try eval first.  What is 'evaluated stream
processing code' ?  It is a function taking streams.  What are
streams?

Note that "streams" for (audio) DSP usually refers to "causal, IIR
stream operations", meaning that functions applied to streams can be
fed one item at a time and will store state.

The interesting problem here is to try to capture output feedback in a
lambda/expression syntax.  A function's output is not named, so how to
name its delayed output?  The simplest problem is a summer:

(lambda (x)
  (+ x (z out)))

Where does 'out' come from?  Shall we just add a magic name, or
require state variables to be named?  It seems to be only output
feedback that causes this problem.  Maybe add a new binding form?

(let ((a ...)
      ((z a) ...)
      ...))

where `z' means next: occurance of (z a) form will add an `a' variable
to the state and will bind its new value.

This is really a sugar problem: the representation is simple: a mimo
fuction where part of the i/o is the state that is fed back.  So let's
ignore it for now, as it is not core.


(define-syntax-rule (lambda-system
                     (si ...) (i ...)
                     (so ...) (o ...)
                     (b ...))
  (lambda (si ... i ...)
    (let* (b ...)
      (values so ... o ...))))


Conclusions:

- using lambda as representation allows lexical scope to be used in
  definitions: no mucking about with symbols

- basic substrate is _initial state_ + _update functions_ (s,i)->(s,o)
  the latter solves the code generation problem: just SSA of lambda
  expressions using AI.

- state initializers should be defined together with code

- composition is important: use the arrow interface for this.

- lexical abstractions go on top of basic initializer + function
  representation, i.e. use a 'z' or '@' form.



[1] http://zwizwa.be/darcs/meta/rai/rai-ssa.rkt



[Reply][About]
[<<][meta][>>][..]