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
_________________________________________________
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/dev

Reply via email to