Sat Jan 22 12:41:55 EST 2011

Sawtooth generator

So, absint functionality is in place.  Next: build saw tooth
oscillator and figure out how to specify the main composition
mechanism for recursive equations.

To get this working we need to create abstract interfaces to

The most important combinator is the one that wraps a state update
function around a state and input/output streams.  It would be
interesting if we could use arbitrary functions for this, and use
naming to perform the linking.

(define (saw phase int frq pole) ... (values phase+ int+))

Something like:

    (in:     (frq))
    (out:    (p))
    (state:  (-> (p i) (p+ i+)))
    (update: (-> (p i frq pole) (p+ i+))

Or as a macro:

(define-syntax (state-space stx)
  (syntax-case stx ()
    ;; Link in terms of node names.
    ((_ (s+ o s i) ;; state space form
        (f fi fo)  ;; pure function body
     (let* ((-> syntax->list))
       #`'(lambda (#,@(-> #'s)
                   #,@(-> #'i))
           (let-values ((fo (f . fi)))
             (values #,@(-> #'s+)
                     #,@(-> #'o))))))))

Note that this does just patching based on names.  In general it is
more straightforward to use output node names to solve multi-out
patching problems, as opposed to combinators.