4.9 Determining the Type of an Object

The following function may be used to obtain a type specifier describing the type of a given object.

[Function] type-of object

There are the following constraints on type-of:

As an example, (type-of "acetylcholinesterase") may return string or simple-string or (simple-string  20), but not array or simple-vector. As another example, it is permitted for (type-of 1729) to return integer or fixnum (if it is indeed a fixnum) or (signed-byte 16) or (integer 1729 1729) or (integer 1685 1750) or even (mod 1730), but not rational or number, because

(typep (+ (expt 9 3) (expt 10 3)) ’integer)

is true, integer is in the list of types mentioned above, and

(subtypep (type-of (+ (expt 1 3) (expt 12 3))) ’integer)

would be false if type-of were to return rational or number.