03 2013 档案

摘要:(define producti (lambda (f a next b) (define iter (lambda (a result) (if (> a b) result (iter (next a) (* result (f a)))))) (iter a 1)))(define product (lambda (f a next b) (if (> a b) 1 (* (f a) (product f (next a) next b)))))(define facto... 阅读全文

posted @ 2013-03-08 17:26 ASOCS 阅读(185) 评论(0) 推荐(0)

摘要:(define sumi (lambda (term a next b) (define iter (lambda (a result) (if (> a b) result (iter (next a) (+ result (term a)))))) (iter a 0)))chez和ikarus的表现完全不一样..chez:> (time (sum (lambda (x) (* 2 x)) 0 (lambda (x) (+ x 1)) 3800011))(time (sum (lambda (...) ...... 阅读全文

posted @ 2013-03-08 16:28 ASOCS 阅读(114) 评论(0) 推荐(0)

摘要:(define s-rule (lambda (f a b n) (let [(h (/ (- b a) (* n 1.0))) (k 0)] (* (/ h 3) (sum (lambda (x) (let ([k (cond [(= x 0) 1] [(= x n) 1] [(odd? x) 4] [else ... 阅读全文

posted @ 2013-03-08 15:43 ASOCS 阅读(100) 评论(0) 推荐(0)

摘要:;1.23(define smallest-divisor (lambda (n) (find-divisor n 2)))(define find-divisor (lambda (n test-divisor) (cond ((> (square test-divisor) n) n) ((divides? test-divisor n) test-divisor) (else (find-divisor n (next test-divisor))))))(define next (lambda (n) (if (= n 2) ... 阅读全文

posted @ 2013-03-06 22:43 ASOCS 阅读(124) 评论(0) 推荐(0)