Common Lisp the Language 2nd Edition


next up previous contents index
Next: Type Upgrading Up: Type Specifiers Previous: Type Conversion Function

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

old_change_begin
(type-of object) returns an implementation-dependent result: some type of which the object is a member. Implementors are encouraged to arrange for type-of to return the most specific type that can be conveniently computed and is likely to be useful to the user. If the argument is a user-defined named structure created by defstruct then type-of will return the type name of that structure. Because the result is implementation-dependent it is usually better to use type-of primarily for debugging purposes; however in a few situations portable code requires the use of type-of such as when the result is to be given to the coerce or map function. On the other hand often the typep function or the typecase construct is more appropriate than type-of.
old_change_end


Compatibility note: In MacLisp the function type-of is called typep Compatibility note: In MacLisp the function type-of is called typept_motif.gif">