This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

AtomQ

AtomQ[expr]
yields True if expr is an expression which cannot be divided into subexpressions, and yields False otherwise.
  • 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.
Test if an expression cannot be subdivided:
Since it is not an atom, its parts can be extracted:
This is a number that is an atom:
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]=
Strings are not subdividable:
Symbols are not subdividable:
Numbers are not subdividable:
Rational numbers appear to have a compound structure:
As numbers, they are not subdividable:
The parts can be accessed through Numerator and Denominator:
Complex numbers appear to have a compound structure:
As numbers, they are not subdividable:
The parts can be accessed through Re and Im:
SparseArray objects are atomic raw objects:
Commands that work with SparseArray objects typically do so on the represented array:
The FullForm of a SparseArray object is designed to be sufficient to reconstruct the raw object:
Find the number of unsubdividable leaves in an expression:
A deeply nested expression:
This is equivalent to LeafCount:
With the option Heads->False, only atoms with no branches are counted:
This corresponds to the dangling leaves you see with TreeForm:
Find the minimum and maximum "depth" of an expression:
Depth gives the maximum depth plus 1:
Map generally maps f on atoms in expr:
This is equivalent to the following recursive function:
New in 1 | Last modified in 5