内容 3.3 Modeling with Mutable Data · 242
练习 自检推理
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)
请画出环境图,展示上述表达式所在的求值环境。
SICP source code scheme
(define a (make-connector))
(define b (make-connector))
(set-value! a 10 'user) SICP source code scheme
(for-each-except
setter inform-about-value constraints) 我的笔记 自动保存