首页 > 代码库 > sicp resolutions
sicp resolutions
**1.1
10
12
8
3
6
Value: a
Value: b
19
#f
4
16
6
16
**1.2
(/ (+ 5
4
(- 2 (- 3 (+ 6 (/ 4 5) ) ) ) )
(* 3
(- 6 2)
(- 2 7) ) )
**1.3
(define (larger x y)
(> x y) x y)
(define (square x) (* x x) )
(define (sum_of_square x y)
(+ (square x) (square y) ) )
(define (sum_of_square_of_two_larger_number x y z)
(if (= x (larger x y) )
(sum_of_square x (larger y z) )
(sum_of_square y (larger x z) ) ) )
**1.4
The comboination use if clause to decide the operator should be - or +, with which the absolute value of b can be get.
**1.5
The interpreter using natural-order evaluation would fall into the endless loop and the other interpreter would give a result as 0.
sicp resolutions