The internal procedures in the
package are essentially nothing more than calls to the primitive procedures
, etc. It was not possible to use the primitives of the language directly because our type-tag system requires that each data object have a type attached to it. In fact, however, all Lisp implementations do have a type system, which they use internally. Primitive predicates such as
determine whether data objects have particular types. Modify the definitions of
from section 2.4.2 so that our generic system takes advantage of Scheme's internal type system. That is to say, the system should work as before except that ordinary numbers should be represented simply as Scheme numbers rather than as pairs whose car is the symbol
There are no comments yet.
You must log in to post a comment.Login
(check-equal? (attach-tag 'scheme-number 42) 42) (check-equal? (attach-tag 'complex (cons 1 2)) (cons 'complex (cons 1 2))) (check-equal? (contents 42) 42) (check-equal? (contents (cons 'complex (cons 1 2))) (cons 1 2)) (check-equal? (type-tag (cons 'complex (cons 1 2))) 'complex) (check-equal? (type-tag 10) 'scheme-number)