3 (define (attach-tag tag contents)
6 (define (integer->rational x)
8 (attach-tag 'rational (cons (contents x) 1))
9 (error "input is not an integer")))
12 (put 'raise '(rational)
13 (lambda (x) (integer->rational x)))
15 (define (integer->real x)
18 (define (rational->real r)
21 (make-real (/ (integer->real n) d))))
23 ;; install into rational package
25 (lambda (r) (rational->real r)))
27 (define (real->complex r)
28 (make-complex-from-real-imag r 0))
30 ;; install into real package
31 (put 'raise '(complex)
32 (lambda (r) (real->complex r)))
35 (apply-generic 'raise x))