内容 3.3 Modeling with Mutable Data · 240
练习 自检推理
Exercise 3.34: Louis Reasoner wants to build a
squarer, a constraint device with two terminals such that the value of
connector b on the second terminal will always be the square of the
value a on the first terminal. He proposes the following simple device
made from a multiplier:
(define (squarer a b) (multiplier a a b))
There is a serious flaw in this idea. Explain.
练习 3.34:Louis Reasoner 想构建一个平方器,这是一种带两个端口的约束器件,使得第二个端口上的连接器 b 的值始终等于第一个端口上的值 a 的平方。他提出了以下由乘法器构成的简单器件:
(define (squarer a b) (multiplier a a b))
这个想法存在一个严重的缺陷。请加以解释。
SICP source code scheme
(define (squarer a b) (multiplier a a b)) 我的笔记 自动保存