摘要: (define (cont-frac n d k) (define (compute m) (cond ((= m k) 0) (else (/ (n m) (+ (d m) (compute (+ m 1))))))) (compute 0))(define (f i) (define (g k) (+ 1 (* k 3))) (define (h m) (cond ((> (g m) i... 阅读全文
posted @ 2007-01-04 22:11 浅蓝の天 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 递归版本:(define (cont-frac n d k) (define (compute m) (cond ((= m k) 0) (else (/ (n m) (+ (d m) (compute (+ m 1))))))) (compute 0)) 迭代版本:(define (cont-frac n d k) (define (cont-frac-iter fin... 阅读全文
posted @ 2007-01-04 20:15 浅蓝の天 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Exercise 1.35: Show that the golden ratio [phi] (section Section 1.2.2 [1-2-2],page 41) is a fixed point of the transformation x |-> 1 + 1/x, and use this factto compute [phi] b y means of the fixed-po... 阅读全文
posted @ 2007-01-04 18:31 浅蓝の天 阅读(143) 评论(0) 推荐(0) 编辑
摘要: (define (accumulate filter? combiner null-value term a next b) (cond ((> a b) null-value) ((filter? a) (combiner (term a) (accumulate filter? combiner null-value t... 阅读全文
posted @ 2007-01-04 14:27 浅蓝の天 阅读(162) 评论(0) 推荐(0) 编辑
摘要: (define (accumulate combiner null-value term a next b) (if (> a b) null-value (combiner (term a) (accumulate combiner null-value term (next a) next b)))) 阅读全文
posted @ 2007-01-04 14:23 浅蓝の天 阅读(189) 评论(0) 推荐(0) 编辑