diff options
author | Ben Burwell <bburwell1@gmail.com> | 2013-04-11 00:14:44 -0400 |
---|---|---|
committer | Ben Burwell <bburwell1@gmail.com> | 2013-04-11 00:14:44 -0400 |
commit | d4e39f38dbc22ec3048512d6bd41a8c95b9d6196 (patch) | |
tree | 03b2630a23b284a95d2989edc6bd080a20d1ed3b | |
parent | bc2ee90e657b6b07c89e3742fa3ea77996985fbf (diff) |
Back to 3.9 interp
-rw-r--r-- | hw08.scm | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -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) |