CS 451 --- Fall 2002 --- Assignment Two ============================================== If our behavior is strict, we do not need fun! -- Zippy the Pinhead ============================================== LAZY SCHEME INTERPRETER Starting with the scheme-in-scheme code in the class notes for 9-Sep-2002, change MY-EVAL to LAZY-EVAL, which is for a lazy dialect of Scheme otherwise identical to the previously interpreted language. Also make any other necessary changes to the interpreter, eg in the apply function and anywhere else you see fit. You'll also want to define FORCE-TO-DEPTH which takes a "lazy" value of the sort output by LAZY-EVAL, along with a number, and converts the given value to a "regular" value down to some depth. Eg (force-to-depth (lazy-eval '(letrec ((a (cons a a))) a) '()) 3) ;; would return this: ;; (((x . x) x . x) (x . x) x . x) ;; where the "x" represents whatever you have for that particular ;; unforced (i.e. as yet uncalculated) value. (See lazy.scm for more examples, especially the last one. Note that force-to-depth given a depth of zero would just be the identity function, ie would just return its first argument. The "depth" refers to the maximum number of CAR's and CDR's necessary to fetch something out.) You will almost certainly want to use DELAY, FORCE and PROMISE? in your lazy interpreter. The code in lazy.scm (in the sep-9 notes) should work with your modified interpreter. ---------------------------------------------------------------- Due noon Thurs Sep 19, 2002. Please comment reasonably. Points for readability and conciseness. Hand your code in by running the script ~bap/bin/hw-handin your-cs451-f2002-hw2.scm on a CS machine. It will generate a time stamp which you should save.