摘要: let赋值域变量不能从另一个获得 阅读全文
posted @ 2017-11-25 02:21 R4mble 阅读(145) 评论(0) 推荐(0) 编辑
摘要: (define (filtered-accumulate filter? combiner null-value term a next b) (define (iter a result) (cond ((> a b) result) ((filter? a) (iter (next a) (combiner (... 阅读全文
posted @ 2017-11-25 01:57 R4mble 阅读(239) 评论(0) 推荐(0) 编辑
摘要: (define (filtered-accumulate filter? combiner null-value term a next b) (define (iter a result) (cond ((> a b) result) ((filter? a) (iter (next a) (combiner (... 阅读全文
posted @ 2017-11-25 01:41 R4mble 阅读(351) 评论(0) 推荐(0) 编辑
摘要: (define (accumulate combiner null-value term a next b) (define (iter a result) (if (> a b) result (iter (next a) (combiner (term a) result)))) (iter a null-value)) (def... 阅读全文
posted @ 2017-11-25 01:10 R4mble 阅读(276) 评论(0) 推荐(0) 编辑
摘要: (define (product term a next b) (if (> a b) 1 (* (term a) (product term (next a) next b)))) (product (lambda (x) x) 1 (lambda (i) (+ i 1)) 5) ... 阅读全文
posted @ 2017-11-25 00:59 R4mble 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 为什么要把iter塞到sum里面去: 嗯,为了减少通信开销. 回头看递归写法: "我们要以困难的方式搞定它!" 阅读全文
posted @ 2017-11-24 23:37 R4mble 阅读(198) 评论(0) 推荐(0) 编辑
摘要: (define (sum term a next b) (if (> a b) 0 (+ (term a) (sum term (next a) next b)))) (define (integral f a b dx) ;积分 (define (add-dx x) (+ x dx)) (* (sum f (+ a (/ dx 2.0)... 阅读全文
posted @ 2017-11-24 23:26 R4mble 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 对过程的抽象: 填充: 拓展: 阅读全文
posted @ 2017-11-24 23:02 R4mble 阅读(140) 评论(0) 推荐(0) 编辑
摘要: (define (next n) (if (= n 2) 3 (+ n 2))) (define (find-divisor n test-divisor) (cond ((> (square test-divisor) n) n) ((divides? n test-divisor) test-divisor) (else (f... 阅读全文
posted @ 2017-11-24 22:00 R4mble 阅读(203) 评论(0) 推荐(0) 编辑
摘要: (define (next-odd n) (if (odd? n) (+ 2 n) (+ 1 n))) (define (smallest-divisor n) (find-divisor n 2)) (define (find-divisor n test-divisor) (cond ((> (square test-divisor) n) n) ... 阅读全文
posted @ 2017-11-24 21:45 R4mble 阅读(226) 评论(0) 推荐(0) 编辑