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.
我在 SICP 中的练习 1.2 中遇到了困难。
将以下内容翻译成前缀形式:
5 + 4 + (2 - (3 - (6 + 4/5))) / 3(6 - 2)(2 - 7)
这就是我所拥有的,我无法弄清楚为什么它不起作用。我错过了什么?
(/ (+ (+ 4 5) (- 2 (- 3 (+ 6 (/ 4 5))))) (* 3 (* (-6 2) (- 2 7))))
(-6 2)
在这里,您尝试调用-6with2作为其参数,这当然不起作用,因为-6它不是函数。您宁愿使用和作为其参数调用该-函数。62
-6
2
-
6
tl; dr:您忘记了 and 之间的-空格6。
(/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5))))) (* 3 (- 6 2) (- 2 7)))