Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- ;;;;;;;;;
- ;; 2.1 ;;
- ;;;;;;;;;
- (define (make-rat n d)
- (cond [(negative? d) (make-rat (- n) (- d))]
- [else
- (define g (gcd n d)) ; gcd always > 0
- (cons (/ n g) (/ d g))]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement