码迷,mamicode.com
首页 > 其他好文 > 详细

sicp resolutions

时间:2015-01-09 12:09:13      阅读:127      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!