Name: Anonymous 2009-05-29 20:56
(define collapse-cf
(λ(rep)
(let ((local-rep (reverse rep)))
(define collapse
(λ(accum x)
(if (empty? (cdr x))
(+ (car x) (/ 1 accum))
(collapse (+ (car x) (/ 1 accum)) (cdr x)))))
(collapse (car local-rep) (cdr local-rep))))))The continued fraction of (1; 1) is the golden mean.
The continued fraction of (1; 2) is the square root of 2.
The continued fraction (88888888; 88888888) is just 88888888.
YOU CALL CARE