aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Burwell <bburwell1@gmail.com>2013-04-11 00:14:44 -0400
committerBen Burwell <bburwell1@gmail.com>2013-04-11 00:14:44 -0400
commitd4e39f38dbc22ec3048512d6bd41a8c95b9d6196 (patch)
tree03b2630a23b284a95d2989edc6bd080a20d1ed3b
parentbc2ee90e657b6b07c89e3742fa3ea77996985fbf (diff)
Back to 3.9 interp
-rw-r--r--hw08.scm13
1 files changed, 6 insertions, 7 deletions
diff --git a/hw08.scm b/hw08.scm
index fe329f2..ca90d5d 100644
--- a/hw08.scm
+++ b/hw08.scm
@@ -209,19 +209,18 @@
(execute-statement false-statement env) ))
; alternate "named" LET syntax
- (while-statement (exp statement) (while-loop exp statement env))
+ (while-statement (exp statement)
+ (let loop ()
+ (if (true-value? (eval-expression exp env))
+ (begin
+ (execute-statement statement env)
+ (loop) ))))
(block-statement (ids statement)
(execute-statement statement
(extend-env ids (map (lambda (id) 0) ids) env) ))
)))
-(define while-loop
- (lambda (exp stmt env)
- (if (true-value? exp)
- (lambda () (execute-statement stmt env) (while-loop exp stmt env))
- (#f))))
-
; expression evaluator
(define eval-expression
(lambda (exp env)