Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对这个例子有疑问
(define (+ x y) (if (= x 0) y (+ (-1+ x) (1+ y))))
-1+ 和 1+ 有什么问题,当我评估它时,我得到了这个结果
但我写了这个,它可以工作
(define (add x y) (if (= x 0) y (+ (- x 1) (+ y 1))))
对于球拍:
add1
1+
sub1
-1+
1-
问题是,这些名称都不是标准名称,因此您无法在所有 Scheme 实现中可靠地使用它们。:-)
您可以通过向 DrRacket 添加 SICP 支持来解决此问题。
http://www.neilvandyke.org/racket-sicp/
再有麻烦告诉我。