The following function may be used to obtain a type specifier describing the type of a given object.
There are the following constraints on type-of:
array | float | package | sequence |
bit-vector | function | pathname | short-float |
character | hash-table | random-state | single-float |
complex | integer | ratio | stream |
condition | long-float | rational | string |
cons | null | readtable | symbol |
double-float | number | restart | vector |
Then (subtypep (type-of x) type)) must return the values t and t; that is, type-of applied to x must return either type itself or a subtype of type that subtypep can recognize in that implementation.
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
is true, integer is in the list of types mentioned above, and
would be false if type-of were to return rational or number.