练习2.73-练习2.74

1.练习2.73 a 没有必要 b (define (insert-sum-proc) (define (deriv-sum exp var) (make-sum (deriv (car exp) var) (deriv (cadr exp) var...

2014-02-07 17:03:39

阅读数:494

评论数:0

练习2.53-练习2.56

1.练习2.53 '(a b c) '((george)) '((y1 y2)) '(y1 y2) #f #f '(red shoes blue socks) 2.练习2.54 (define (equal? s1 s2) (cond ((and (null? s1) (...

2014-01-23 19:10:57

阅读数:468

评论数:0

练习2.48-练习2.51

1.练习2.48 (define (make-segment start end) (cons start end)) (define (start-segment seg) (car seg)) (define (end-segment seg) (cdr seg)) 2.练...

2014-01-22 19:12:03

阅读数:453

评论数:0

练习1.23-练习1.30

1.练习1.23 改后的代码如下: (define (find-divisor-better n a) (cond ((> (square a) n) n) ((divides?-better n a) a) (else (find-divisor-better n (next-2 ...

2014-01-20 20:10:43

阅读数:468

评论数:0

练习2.21-练习2.35

1.练习2.21 (define (square-list items) (if (null? items) '() (cons (square (car items)) (square-list (cdr items))))) (define (square-lis...

2014-01-20 20:10:25

阅读数:435

评论数:0

练习2.41-练习2.47

1.练习2.41 (define (seprate-except x except) (filter (lambda (couple) (let ((first (car couple)) (second (cadr couple)...

2014-01-20 18:59:14

阅读数:463

评论数:0

练习2.11-练习2.20

1.练习2.11 (define (mul-interval x y) (let ((x1 (lower-bound x)) (x2 (upper-bound x)) (y1 (lower-bound y)) (y2 (upper-bound y))) (let ((zzx ...

2014-01-17 21:42:30

阅读数:442

评论数:0

练习2.2-练习2.10

1.练习2.2 (define (make-segment start end) (cons start end)) (define (start-segment seg) (car seg)) (define (end-segment seg) (cdr seg)) (def...

2014-01-15 21:29:45

阅读数:430

评论数:0

练习2.1

1.练习2.1 (define (check-pos-neg a b) (or (and (not ( b 0)) (and (not (> a 0)) (< b 0)))) (define (make-rat n d) (let ((g (gcd (abs n...

2014-01-14 22:59:32

阅读数:382

评论数:0

练习1.40-练习1.46

1.练习1.40 (define (cubic a b c) (define (cube x) (* x x x)) (lambda (x) (+ (cube x) (* a (square x)) (* b x) c))) ...

2014-01-13 21:01:26

阅读数:478

评论数:0

练习1.35-练习1-38

1.练习1.35 (fixed-point (lambda (x) (+ 1 (/ 1 x))) 1.0) 2.练习1.36 不用平均阻尼方式: (fixed-point-display (lambda (x) (/ (log 1000) (log x))) 2.0) 结果为: 2. ...

2014-01-11 23:07:30

阅读数:371

评论数:0

练习1.31-练习1.34

最近对于Lisp的强大和高深还是深有体会的,可以将函数作为参数进行调用,这样在很大的程度上可以提高函数的抽象性,即将具有公共模式的函数进行抽象。例如在SICP中,首先将累加和的过程进行了抽象,然后在累加和的基础上抽象出了累乘积,进而又发现了累加和与累乘积的共同点,进一步抽象成了一个叫做accumu...

2014-01-10 19:19:02

阅读数:397

评论数:0

练习1.23-练习1.30

1.练习1.23改后的代码如下: (define (find-divisor-better n a) (cond ((> (square a) n) n) ((divides?-better n a) a) (else (find-divisor-better n (next-2...

2014-01-09 21:05:38

阅读数:386

评论数:0

练习1.18-练习1.22

1.练习1.18 (define (*-iter a b n) (cond ((= n 0) a) ((even? n) (*-iter a (double b) (halve n))) (else (*-iter (+ a b) b (- n 1))))) (define (* b n...

2014-01-08 21:33:03

阅读数:550

评论数:0

练习1.10-练习1.17

1.练习1.10 表达式的求值就不说了。 (define (f n) (A 0 n)) -------2n (define (g n) (A 1 n))-------2的n次方 (define (h n) (A 2 n))-------n个2的次方,例如:(h 4)表示为2的2次方的2次方的2次方...

2014-01-07 20:47:31

阅读数:457

评论数:0

练习1.1-练习1.9

1. 练习1.1 这个题没有什么好说的了,只要把代码敲出来,运行一遍就可以了。 2. 练习1.2 这个题应该不算难吧,没有看过别人的答案,我把我的贴出来吧。 (/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5))))) (* 3 (- 6 2) (- 2 7))) 3...

2014-01-06 21:20:53

阅读数:395

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭