| From: David Van Horn (dvanhorn at ccs.neu.edu) Date: Wed Dec 7 12:25:34 EST 2011 |
|
It would be nice if gcd and lcm were extended to rational numbers, which
seems in-line with Scheme's philosophy (but not standards) on numbers.
(define (gcd-rational . rs)
(/ (apply gcd (map numerator rs))
(apply lcm (map denominator rs))))
(define (lcm-rational . rs)
(/ (abs (apply * rs))
(apply gcd-rational rs)))
David
| Posted on the dev mailing list. |
|