From d4e39f38dbc22ec3048512d6bd41a8c95b9d6196 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Thu, 11 Apr 2013 00:14:44 -0400 Subject: Back to 3.9 interp --- hw08.scm | 13 ++++++------- 1 file 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) -- cgit v1.2.3