diff --git a/eval.scm b/eval.scm index 8461e589..2e92833c 100644 --- a/eval.scm +++ b/eval.scm @@ -358,11 +358,13 @@ ((begin? exp) (analyze-sequence (begin-actions exp))) ((cond? exp) (analyze (cond->if exp))) ;; END derived expression processing + + ;; experimenting with passing these back to eval + ((compound-procedure? exp) + (lambda (env) exp)) ;; TODO: good enough? update env? + ;; END experimental code + ((application? exp) (analyze-application exp)) -;; TODO: ;; JAE - testing with these next 3 -;; TODO: ((primitive-procedure? exp) exp) -;; TODO: ((compound-procedure? exp) exp) -;; TODO: ((procedure? exp) exp) (else (error "Unknown expression type -- ANALYZE" exp)))) ;(lambda () 'TODO-unknown-exp-type)))) ; JAE - this is a debug line diff --git a/test.scm b/test.scm index fd1f752b..07f44f59 100644 --- a/test.scm +++ b/test.scm @@ -1,17 +1,19 @@ ;; Temporary testing, delete this once it works -(define (mywrite x) - (write x)) +(define (call2 fn x y) + (write + (fn x y))) (define (call fn a) (fn a)) (call write 'hello) - +call2 ;; TODO: or would be optimized out... need to fix that ;; Demonstrate sending an interpreted function to compiled code ;; I think in order for this to work, the compiled code would have to ;; detect an interpreted proc, and use eval to execute it ;; TODO: to debug this, may try placing printfs in runtime's apply -(eval '(call (lambda (x) x) (display (+ 1 1)))) +(eval '(call2 (lambda (x y) (+ y x)) 2 3)) +;(eval '(call (lambda (x) (+ 1 x)) (display (+ 1 1)))) ;(eval '(call write 1)) ;(eval '(call mywrite 1))