PRODUCTS
PURCHASE
FOR USERS
COMPANY
OUR SITES
DOCUMENTATION CENTER SEARCH
Mathematica
>
Expression Structure
>
Built-in
Mathematica
Symbol
Expressions as Trees
Levels in Expressions
Tutorials »
|
Apply
Map
Scan
Depth
See Also »
|
Expression Structure
More About »
Level
Level
[
expr
,
levelspec
]
gives a list of all subexpressions of
expr
on levels specified by
levelspec
.
Level
[
expr
,
levelspec
,
f
]
applies
f
to the sequence of subexpressions.
MORE INFORMATION
Level
uses standard level specifications:
n
levels
1
through
n
Infinity
levels
1
through
Infinity
{
n
}
level
n
only
{
n
1
,
n
2
}
levels
n
1
through
n
2
Level
[
expr
, {-1}]
gives a list of all "atomic" objects in
expr
.
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
0
corresponds to the whole expression.
With the option setting
Heads
->
True
,
Level
includes heads of expressions, and their parts.
Level
traverses expressions in depth-first order, so that the subexpressions in the final list are ordered lexicographically by their indices.
EXAMPLES
CLOSE ALL
Basic Examples
(3)
Give all parts at level -1:
In[1]:=
Out[1]=
Give all parts down to level 2:
In[1]:=
Out[1]=
Give all parts at levels 0 through infinity:
In[1]:=
Out[1]=
Generalizations & Extensions
(5)
Applications
(1)
Properties & Relations
(1)
Possible Issues
(1)
SEE ALSO
Apply
Map
Scan
Depth
TUTORIALS
Expressions as Trees
Levels in Expressions
MORE ABOUT
Expression Structure
New in 1
© 2008 Wolfram Research, Inc.