Code Review
Compare your solutions
#| BEGIN (Write your solution here) |#
(define (equ? x y) (apply-generic 'equ? x y))
(define (update-scheme-number-package)
(put 'equ? '(scheme-number scheme-number)
(lambda (x y) (= x y))
)
'done
)
(define (update-rational-package)
(define (numer x) (car x))
(define (denom x) (cdr x))
(put 'equ? '(rational rational)
(lambda (x y) (and (= (numer x) (numer y)) (= (denom x) (denom y))))
)
)
(define (update-complex-package)
(put 'equ? '(complex complex)
(lambda (x y) (and (= (car (contents x)) (car (contents y))) (= (cdr (contents x)) (cdr (contents y)))))
)
)
#| END |#