[<<][meta][>>][..]
Fri Feb 22 16:56:31 CET 2013

feedback/n trouble

It's a bit hard to understand..  Made for juggling state nodes, so can
it be used for someting else?

I'm reverting to the old implementation.  This is the current doodle:

(define-syntax (ai-lambda-feedback stx)
  (syntax-case stx ()
    ((_ (state ...) (in ...) expr)
     ;; Define the function body of a standard stream processor.
     #`(let ((update
              (ai-lambda (state ... in ...) expr)))
         ;; Pass it to the implementation through feedback/n construct.
         ;; The result behaves as (ai-lambda (in ...))
         (ai-app feedback/n
                 '(state ...)
                 '(in ...)
                 update)))))


(define (make-feedback-prim make-state-nodes
                            register-state-nodes!)
  (lambda (sem state-args args update)
    (make-ai-function
     ;; Every time this function is evaluated (i.e. for stateful
     ;; operation instance) a set if state i/o nodes is created.
     (lambda (sem . in)
       (let*
           ((nb-state  (length state-args))
            (state-in  (make-state-nodes state-args))
            (exprs     (values-list
                        (apply (ai-function-proc update)
                               sem 
                               (append state-in in))))
            (state-out (take exprs nb-state))
            (out       (drop exprs nb-state)))
         (register-state-nodes! state-in state-out)
         (apply values out))))
    args))



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