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.
|
(define (cont-frac n d k) |
|
(define (loop res t) |
|
(if (eq? t 0) |
|
res |
|
(loop (/ (n t) |
|
(+ (d t) res)) |
|
(- t 1)))) |
|
(loop 0 k)) |
|
|
|
(define (e-euler k) |
|
(+ 2.0 (cont-frac (lambda (i) 1.0) |
|
(lambda (i) |
|
(if (eq? (remainder i 3) 2) |
|
(/ (+ i 1) 1.5) |
|
1)) |
|
k)))
|
|
|