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

atom


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

Syntax

(atom expr)
expr - the expression to check
returns -  T  if the value is an atom, NIL otherwise

Description

The 'atom' predicate checks if the 'expr' is an atom.  T  is returned if 'expr' is an atom, NIL is returned otherwise.

Examples

  (atom 'a)                      ; returns T - symbol
  (atom #'atom)                  ; returns T - subr - function
  (atom "string")                ; returns T - string
  (atom 4)                       ; returns T - integer
  (atom 4.5)                     ; returns T - float
  (atom object)                  ; returns T - object
  (atom #(1 2 3))                ; returns T - array
  (atom #'quote)                 ; returns T - fsubr
  (atom *standard-output*)       ; returns T - stream
  (atom '())                     ; returns T - NIL is an atom
  (atom #'defvar)                ; returns T - closure - macro
  (atom (lambda (x) (print x)))  ; returns T - closure - lambda
  (atom '(a b c))                ; returns NIL - list
  (setq a '(a b))                ; set up A with value (A B)
  (atom a)                       ; returns NIL - value of A is not an atom

Note: NIL or '() is used in many places as a list-class or atom-class expression. Both 'atom' and listp, when applied to NIL, return  T .

See the atom predicate function in the XLISP 2.0 manual.

  Back to Top


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