SICP 题解集合

1.1(略)

1.2

1 biwascheme> 
2 (/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5)))))
3    (* 3 (- 6 2) (- 2 7)))
4 => -0.24666666666666667

1.3

 1 biwascheme> 
 2 (define (BiggerSum x y z)
 3     (define s1 (+ x y))
 4     (define s2 (+ x z))
 5     (define s3 (+ y z))
 6     (cond ((and (> s1 s2) (> s1 s3)) s1)
 7           ((and (> s2 s1) (> s2 s3)) s2)
 8           (else s3)
 9     )
10 )
11 biwascheme> (BiggerSum 2 1 3)
12 => 5
View Code

1.4   (略)

1.5

若解释器采用正则序求值,Ben可以看到解释器顺利返回0;

若解释器采用应用序,则程序会陷入无限循环。

 

猜你喜欢

转载自www.cnblogs.com/Blogggggg/p/10138220.html