Skip to content

Instantly share code, notes, and snippets.

Created Sep 25, 2012
What would you like to do?
(define (continued-fraction r)
(let loop ([p (numerator r)]
[q (denominator r)])
(receive (quot rem) (quotient&remainder p q)
(if (zero? rem)
(list quot)
(lcons quot (loop q rem))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment