ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   4 Types and Classes   4.4 Dictionary of Types and Classes

4.4.27 type-of Function

Syntax:
type-of object    typespec

Arguments and Values:
object - an object.

typespec - a type specifier.

Description:

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

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)

See Also:
array-element-type, class-of, defstruct, typecase, typep, Section 4.2 Types

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

Allegro CL Implementation Details:
None.

Home Previous Up Next Table of Contents Index
© Franz Inc. All Rights Reserved - File last updated 2022-07-25