XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

type-of


Type:   -   function (subr)
Source:   -   xlsys.c

Syntax

(type-of expr)
expr - an expression to check
returns - the type of the expression

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: 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.

See the type-of function in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next