You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sicp-all-tasks/sicp/2_002e78

15 lines
840 B

Exercise 2.78: The internal procedures in the
scheme-number 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 symbol? and number? determine whether data
objects have particular types. Modify the definitions of type-tag,
contents, and attach-tag from 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 scheme-number.