首页 > 其他 > 详细

sicp resolutions

时间:2015-01-09 12:06:06      阅读:292      评论:0      收藏:0      [点我收藏+]

**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

原文:http://www.cnblogs.com/alex-wood/p/4212714.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!