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.

13 lines
272 B

(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 (cont-frac-rec n d k)
(if (eq? k 0)
0
(/ (n 1) (+ (d 1) (cont-frac-rec n d (- k 1))))))