灯下 登录
计算机科学 / SICP / 4.1.3 Evaluator Data Structures

Exercise 4.13 · 习题

Exercise 4.13: Scheme allows us to create new

bindings for variables by means of define, but provides no way to get

rid of bindings. Implement for the evaluator a special form

make-unbound! that removes the binding of a given symbol from the

environment in which the make-unbound! expression is evaluated. This

problem is not completely specified. For example, should we remove only the

binding in the first frame of the environment? Complete the specification and

justify any choices you make.

练习 4.13:Scheme 允许我们通过 define 为变量创建新的绑定,但没有提供消除绑定的方式。请为求值器实现一个特殊形式 make-unbound!,用于从对 make-unbound! 表达式求值时所在的环境中移除给定符号的绑定。这道题没有完全规定好:例如,我们是否只移除环境第一个框架中的绑定?请完善规约,并为你的选择提供理由。