User Tools


Function TYPE-OF

Syntax

  • type-of objecttypespec

Arguments and Values

Description

Returns a type specifier, typespec, for a type that has the object as an element. The typespec satisfies the following:

(subtypep (type-of object) (class-of object))

true true

Examples

(type-of 'a)

SYMBOL

(type-of '(1 . 2))

CONS

or (CONS FIXNUM FIXNUM)

(type-of #c(0 1))

COMPLEX

or (COMPLEX INTEGER)

(defstruct temp-struct x y z)

TEMP-STRUCT

(type-of (make-temp-struct))

TEMP-STRUCT

(type-of "abc")

STRING

or (STRING 3)

(subtypep (type-of "abc") 'string)

true true

(type-of (expt 2 40))

BIGNUM

or INTEGER

or (INTEGER 1099511627776 1099511627776)

or SYSTEM::TWO-WORD-BIGNUM

or FIXNUM

(subtypep (type-of 112312) 'integer)

true true

(defvar *foo* (make-array 5 :element-type t))

*FOO*

(class-name (class-of *foo*))

VECTOR

(type-of *foo*)

VECTOR

or (VECTOR T 5)

Affected By

None.

Exceptional Situations

None.

See Also

Notes

Implementors are encouraged to arrange for type-of to return a portable value.

\issue{TYPE-OF-UNDERCONSTRAINED:ADD-CONSTRAINTS} \issue{TYPE-OF-UNDERCONSTRAINED:ADD-CONSTRAINTS} \issue{TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND} \issue{TYPE-OF-AND-PREDEFINED-CLASSES:TYPE-OF-HANDLES-FLOATS} \issue{TYPE-OF-UNDERCONSTRAINED:ADD-CONSTRAINTS}