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


or replaces the head of expr by f.
or replaces heads at level of expr by f.
replaces heads in parts of expr specified by levelspec.
  • Apply uses standard level specifications:
nlevels through n
Infinitylevels through Infinity
{n}level n only
{n1,n2}levels through
  • The default value for levelspec in Apply is .
  • is equivalent to Apply.
  • A positive level n consists of all parts of expr specified by n indices.
  • A negative level -n consists of all parts of expr with depth n.
  • Level consists of numbers, symbols, and other objects that do not have subparts.
  • Level corresponds to the whole expression.
  • Apply always effectively constructs a complete new expression and then evaluates it.
  • Apply operates on SparseArray objects just as it would on the corresponding ordinary lists.
Apply gets rid of a level of lists:
Click for copyable input
Click for copyable input
Click for copyable input
Apply gets rid of a level of lists:
Click for copyable input
Apply at level (default):
Apply at level :
The short form is equivalent to applying at level :
Apply at levels and :
Apply down to level (excluding level ):
Apply at levels through :
Apply at all levels, starting at level :
Apply also at level :
Negative levels:
Positive and negative levels can be mixed:
Different heads at each level:
Apply also inside heads at the levels specified:
Apply works with any head, not just List:
Apply works on sparse arrays:
Apply inside heads as well as arguments:
Display the factorization of an integer using superscripts:
Create a table from a list of range specifications:
Turn a function that takes several arguments into one that takes a list of arguments:
Leaves are visited before roots:
Total does effectively the same thing as applying Plus to a list:
Using in a pure function has the same effect as using Apply:
Three ways to apply a function at level :
Ordinary function application takes the list as a single argument:
Apply takes the elements of the list as separate arguments:
Applying to atomic objects that do not have subparts effectively does nothing:
New in 1 | Last modified in 5