Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference

atom


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

Syntax

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

Description

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

Examples

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

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

See also:

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference