内容 4.2 Variations on a Scheme — Lazy Evaluation · 343
练习 自检推理
Exercise 4.33: Ben Bitdiddle tests the lazy list
implementation given above by evaluating the expression
(car '(a b c))
To his surprise, this produces an error. After some thought, he realizes that
the “lists” obtained by reading in quoted expressions are different from the
lists manipulated by the new definitions of cons, car, and
cdr. Modify the evaluator’s treatment of quoted expressions so that
quoted lists typed at the driver loop will produce true lazy lists.
练习 4.33:Ben Bitdiddle 通过对以下表达式求值来测试上面给出的惰性表实现:
(car '(a b c))
令他惊讶的是,这产生了一个错误。经过思考,他意识到,通过读入带引号表达式所得到的"表"与由新定义的 cons、car 和 cdr 操作的表是不同的。请修改求值器对带引号表达式的处理方式,使得在驱动循环中输入的带引号表能产生真正的惰性表。
SICP source code scheme
(car '(a b c)) 我的笔记 自动保存