sicp 1.5

下面这段代码:

 

(define (p) (p))

(define (test x y)
  (if (= x 0)
      0
      y))

(test 0 (p))

应用序(applicative-order)求值:

(test 0 (p))

(test 0 (p))

...

求值过程不会结束,DrScheme即是应用序求值

 

正则序(normal-order)求值:

(test 0 (p))

(if (= 0 0) 0 (p))

0

结果为0

你可能感兴趣的:(SICP)