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

symbolp


Type:   -   predicate function (subr)
Source:   -   xllist.c

Syntax

(symbolp expr)
expr - the expression to check
returns -  T  if the expression is a symbol, NIL otherwise

Description

The 'symbolp' predicate function checks if an 'expr' is a valid symbol.  T  is returned if 'expr' is a symbol, NIL is returned otherwise. An 'expr' that evaluates to an integer, function [subr or otherwise], and so on is not a symbol. However, the quoted [un-evaluated] name of these objects [like 'myarray] is a valid symbol.

Examples

(symbolp (make-symbol "a"))       ; returns T - symbol
(symbolp 'a)                      ; returns T - symbol

(symbolp #(1 2 3))                ; returns NIL - array
(symbolp (lambda (x) (print x)))  ; returns NIL - closure
(symbolp *standard-output*)       ; returns NIL - stream
(symbolp 1.2)                     ; returns NIL - float
(symbolp 2)                       ; returns NIL - integer
(symbolp object)                  ; returns NIL - object
(symbolp "hi")                    ; returns NIL - string

(symbolp #'car)                   ; returns NIL - subr
(symbolp 'car)                    ; returns T - it is a symbol now
(symbolp '2)                      ; returns NIL - not a symbol

See the symbolp predicate function in the XLISP 2.0 manual.

  Back to Top


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