some solutions for MIT Press's "structure and interpretation of computer programs", I guess
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

#### 54 lines 929 B Raw Permalink Blame History

 `(define (cube x)` ` (* x x x))` `;(define (sum-integers a b)` `; (if (> a b)` `; 0` `; (+ a (sum-integers (+ a 1) b))))` `;` `;(define (sum-cubes a b)` `; (if (> a b)` `; 0` `; (+ a (sum-integers (+ a 1) b))))` `;` `;(define (pi-sum a b)` `; (if (> a b)` `; 0` `; (+ (/ 1.0 (* a (+ a 2)))` `; (pi-sum (+ a 4) b))))` `;; (define ( a b)` `;; (if (> a b)` `;; 0` `;; (+ ( a)` `;; ( ( a) b))))` `(define (sum term a next b)` ` (if (> a b)` ` 0` ` (+ (term a)` ` (sum term (next a) next b))))` `(define (inc n)` ` (+ n 1))` `(define (sum-cubes a b)` ` (sum cube a inc b))` `(define (identity x) x)` `(define (sum-integers a b)` ` (sum identity a inc b))` `(define (pi-sum a b)` ` (define (pi-term x)` ` (/ 1.0 (* x (+ x 2))))` ` (define (pi-next x)` ` (+ x 4))` ` (sum pi-term a pi-next b))` `(define (integral f a b dx)` ` (define (add-dx x)` ` (+ x dx))` ` (* (sum f (+ a (/ dx 2.0)) add-dx b)` ``` dx)) ``` ``` ```