4.2.2. An Interpreter with Lazy Evaluation
Exercise 4.27

The interaction between lazy evaluation and side effects

Suppose we type in the following definitions to the lazy evaluator:

(define count 0)
(define (id x)
  (set! count (+ count 1))
  x)

Give the missing values in the following sequence of interactions, and explain your answers.

(define w (id (id 10)))
;;; L-Eval input:
count
;;; L-Eval value:
response
;;; L-Eval input:
w
;;; L-Eval value:
response
;;; L-Eval input:
count
;;; L-Eval value:
response

Nobody's finished this exercise yet. You'll be the first!


There are no comments yet.

Authentication required

You must log in to post a comment.

Login