Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

type-of

type-of

type: function (subr)
location: built-in
source file: xlsys.c
Common LISP compatible: similar
supported on: all machines

SYNTAX

(type-of <expr> )
        <expr>          -       an expression to check

DESCRIPTION

The TYPE-OF function returns the type of the expression.

EXAMPLES

(type-of NIL)                           ; returns NIL           
(type-of '#(1 2 3))                     ; returns ARRAY 
(type-of (lambda (x) (print x)))        ; returns CLOSURE
(type-of '(a b))                        ; returns CONS          
(type-of #'savefun)                     ; returns CLOSURE
(type-of '(a . b))                      ; returns CONS          
(type-of *standard-output*)             ; returns FILE-STREAM
(type-of 1.2)                           ; returns FLONUM        
(type-of #'do)                          ; returns FSUBR        
(type-of 1)                             ; returns FIXNUM        
(type-of object)                        ; returns OBJECT        
(type-of "str")                         ; returns STRING        
(type-of #'car)                         ; returns SUBR          
(type-of 'a)                            ; returns SYMBOL        
(type-of #\a)                           ; returns CHARACTER
(type-of (make-string-input-stream "a")); returns UNNAMED-STREAM

COMMON LISP COMPATIBILITY: The XLISP and Common LISP TYPE-OF functions are basically the same. Differences between the two can occur in what the types are called (like CHARACTER in XLISP and STANDARD-CHAR in Common LISP). Also, Common LISP can give additional information - for strings, it returns a list of the form (SIMPLE-STRING 32) where the number 32 is the string size.


Go to the first, previous, next, last section, table of contents.