灯下 登录
计算机科学 / SICP / 3.3.5 Propagation of Constraints

Exercise 3.36 · 习题

Exercise 3.36: Suppose we evaluate the following
sequence of expressions in the global environment:

(define a (make-connector))
(define b (make-connector))
(set-value! a 10 'user)

At some time during evaluation of the set-value!, the following
expression from the connector’s local procedure is evaluated:

(for-each-except
setter inform-about-value constraints)

Draw an environment diagram showing the environment in which the above

expression is evaluated.

练习 3.36:假设我们在全局环境中依次求值如下表达式:

(define a (make-connector))
(define b (make-connector))
(set-value! a 10 'user)

在 set-value! 的求值过程中的某个时刻,连接器的局部过程中求值了如下表达式:

(for-each-except
setter inform-about-value constraints)

请画出环境图,展示上述表达式所在的求值环境。

Racket #lang sicp
(define a (make-connector))
(define b (make-connector))
(set-value! a 10 'user)
Racket #lang sicp
(for-each-except
 setter inform-about-value constraints)