AtomQ

AtomQ[expr]
yields True if expr is an expression which cannot be divided into subexpressions, and yields False otherwise.

DetailsDetails

  • You can use AtomQ in a recursive procedure to tell when you have reached the bottom of the tree corresponding to an expression.
  • AtomQ gives True for symbols, numbers, strings, and other raw objects, such as sparse arrays.
  • AtomQ gives True for any object whose subparts cannot be accessed using functions like Map.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Test if an expression cannot be subdivided:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Since it is not an atom, its parts can be extracted:

In[3]:=
Click for copyable input
Out[3]=

This is a number that is an atom:

In[4]:=
Click for copyable input
Out[4]=
Introduced in 1988
(1.0)
| Updated in 2003
(5.0)