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.
必须根据以下价值做出决定:
(测试 0(p))
其中 test 定义为:
(define (test x y) (if (= x 0) 0 y))
p 定义为:
(define (p) (p))
当我评估(test 0 (p))解释器进入无限循环时,表明它正在评估p. 这显示了正常顺序评估,因为操作数在被替换为参数之前被评估。SICP 说 LISP 使用应用顺序评估。
(test 0 (p))
p
这显示了正常顺序评估,因为操作数在被替换为参数之前被评估
其实你弄错了。应用顺序是首先计算操作数的时间。正常顺序是当参数被替换为未计算的表达式时。
因此球拍使用应用顺序,因为正如您所说,首先评估参数(除非您使用“Lazy Racket”,在这种情况下,它使用按需调用又名延迟评估,这就像正常顺序一样,除了每个参数最多评估一次)。