![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
计算机程序的构造和解释(SICP) 答案
文章平均质量分 71
郭東
这个作者很懒,什么都没留下…
展开
-
SICP 1.09-1.10
习题1.9(define (+ a b) (if (= a 0) b (inc (+ (dec a) b))))(+ 4 5)(inc (+ 3 5))(inc (inc (+ 2 5)))(inc (inc (inc (+ 1 5))))(inc (inc (inc (inc (+ 0 5)))))(inc (inc (inc (inc 5))))(原创 2016-08-31 13:43:52 · 944 阅读 · 0 评论 -
SICP 1.40-1.46
练习1.40(define (cubic a b c) (lambda (x) (+ (* x x x) (* a x x) (* b x) c)))(define (derive g) (define dx 0.00001) (lambda (x) (/ (- (g (+ x dx)) (g x)) dx)))(define (newton-transform原创 2016-09-06 11:53:51 · 376 阅读 · 0 评论 -
SICP 1.06-1.08
习题1.6 lisp原创 2016-08-30 16:55:16 · 555 阅读 · 0 评论 -
SICP 1.35-1.39
练习1.35(define tolerance 0.00001)(define (fixed-point f first-guess) (define (close-enough? v1 v2) (< (abs (- v1 v2)) tolerance)) (define (try guess) (let ((next (f guess))) (i原创 2016-09-06 11:34:31 · 347 阅读 · 0 评论 -
SICP 1.01-1.05
习题1.110=> 10(+ 5 3 4) => 12(- 9 1) => 8(/ 6 2) => 3(+ (* 2 4) (- 4 6)) => 6 (define a 3)a=> 3(define b (+ a 1)) b=> 4(+ a b (* a b)) => 19(= a b) => #f(if (and (> b a) (< b (* a b))) b原创 2016-08-30 16:10:39 · 580 阅读 · 0 评论 -
SICP 1.11-1.13
习题1.11 1.递归算法(define (f n) (if ( n 3) n (+ (f (- n 1)) (* 2 (f (- n 2))) (* 3 (f (- n 3))))))2原创 2016-08-31 15:10:05 · 543 阅读 · 0 评论 -
SICP 1.34
* SICP 1.34* let表达式只是作为基础的lambda条达式的语法糖。(let ((<var1> <exp1>) (<var2> <exp2>) ... (<varn> <expn>)) <body>)等同于:((lambda (<var1> ... <varn>) <body>) <exp1> ... <expn>)(d原创 2016-09-06 11:30:41 · 513 阅读 · 0 评论 -
SICP 1.29-1.33
练习1.29 待续。。。练习1.30(define (sum term a next b) (define (iter a result) (if (= a b) result (iter (next a) (+ result (term a))))) (iter a 0))原创 2016-09-02 18:28:16 · 396 阅读 · 0 评论 -
SICP 1.21-1.28
寻找因子法(define (smallest-divisor n) (find-divisor n 2))(define (find-divisor n test-divisor) (cond ((> (square test-divisor) n) n) ((divides? test-divisor n) test-divisor) (else (find原创 2016-09-01 17:57:04 · 469 阅读 · 1 评论 -
SICP 1.20
练习1.20(define (gcd a b) (if (= b 0) a (gcd b (remainder a b))))正则序(gcd 206 40)(gcd 40 (remainder 206 40))(gcd (rmainder 206 40) (remainder 40 (remainder 206 40)))(gcd (remainder 40原创 2016-09-01 17:53:19 · 493 阅读 · 0 评论 -
SICP 1.16-1.19
习题1.16(define (fast-expt b n) (define (fast-expt-iter result b n) if (原创 2016-08-31 18:11:47 · 440 阅读 · 0 评论 -
SICP 1.14-1.15
习题1.14 习题1.15(define (cube x) (* x x x))(define (p x) (- (* 3 x) (* 4 (cube x))))(define (sine angle) (if (not (> (abs angle) 0.1)) angle (p (sine (/ angle 3.0)))))参照: a) Each tim原创 2016-08-31 17:48:11 · 540 阅读 · 0 评论 -
SICP 2.01-2.03
练习2.01(define (make-rat n d) (let ((g (gcd n d))) (if (< (* n d) 0) (cons (/ (- (abs n) g) (/ (abs d) g))) (cons (/ (abs n) g) (/ (abs d) g)))))(define (numer x) (car x)原创 2016-09-07 15:44:53 · 264 阅读 · 0 评论