3 ;; modify type-tag, contents, and attach-tag so that primitive numbers need not
6 (define (type-tag datum)
8 [(pair? datum) (car datum)]
9 [(number? datum) 'scheme-number]
11 (error "Bad tagged datum -- TYPE-TAG" datum)]))
13 (define (contents datum)
15 [(pair? datum) (cdr datum)]
16 [(number? datum) datum]
18 (error "Bad tagged datum -- CONTENTS" datum)]))
20 (define (attach-tag type-tag contents)
21 (if (number? contents)
23 (cons type-tag contents)))