[<<][meta][>>][..]

Sun Jan 20 19:14:00 CET 2013

## ai-eval.rkt

How should the direct evaluation of fold-state work?
(fold-state sem
1
(lambda (s)
(int-loop (sem) s x)))
I'm not sure this will work since it mixes some types. fold-loop
fundamentally alters the semantics of its subsyntax (from stream to
scalar!).
( Confusions like this won't happen in a typed language ! )
Maybe it's best to change the outside of the abstraction a bit to at
least make it more meaningful.
Another thing this brings up is: what happens when code inside a
fold-state form references a stateful processor?
(define level-test
(lambda ((s) (x))
(values (integrate s) (integrate x))))
(lambda (si0_2295 si0_2298 si0_2294 i0_2293)
(let*-values (((o0_2296) (p_add si0_2295 si0_2294))
((so0_2297) (p_set o0_2296))
((o0_2299) (p_add si0_2298 i0_2293))
((so0_2300) (p_set o0_2299))
((so0_2301) (p_set o0_2296)))
(values so0_2297 so0_2300 so0_2301 o0_2299)))
After substitution:
(lambda (si0 si1 si2 i)
(let*-values (((o0) (p_add si0 si2))
((so0) (p_set o0))
((o1) (p_add si1 i))
((so1) (p_set o1))
((so2) (p_set o0)))
(values so0 so1 so2 o1)))
so2 = so0 <- (p_add si0 si2) ;; a, 2a, 4a ,....
so1 = o1 <- (p_add si1 i) ;; integral of i
It seems to just work. The output is a single integral, coming from
'(integrate x)', and a geometric series from '(integrate s)'
Weird.. so what does it mean, stream-wize?
The thing is, evaluation can be side-stepped since there is a
compilation to Scheme part that can just compute the whole thing at
once.
I think it's probably best to tuck away the abstraction behind a
lambda form only, and remove the `causal' form.
;; AI can call the function properly. (Leaky abstraction?)
(define-syntax (causal stx)
(syntax-case stx ()
((_ nb-state (op arg ...))
(let* ((n (syntax->datum #'nb-state))
(s (generate-temporaries (make-list n 's))))
#`(fold-state (ai-semantics)
nb-state
(lambda #,s
(op (ai-semantics) #,@s arg ...)))))))

[Reply][About]

[<<][meta][>>][..]