PRODUCTS
PURCHASE
FOR USERS
COMPANY
OUR SITES
DOCUMENTATION CENTER SEARCH
Mathematica
>
Expression Structure
>
Built-in
Mathematica
Symbol
Expressions as Trees
Memory Management
Tutorials »
|
ByteCount
Length
Depth
AtomQ
Hash
See Also »
|
Expression Structure
Memory Measurement & Optimization
More About »
LeafCount
LeafCount
[
expr
]
gives the total number of indivisible subexpressions in
expr
.
MORE INFORMATION
LeafCount
gives a measure of the total "size" of an expression.
LeafCount
counts the number of subexpressions in
expr
which correspond to "leaves" on the expression tree.
LeafCount
is based on
FullForm
representation of expressions.
Numbers with heads
Rational
and
Complex
are treated as composite objects, just as in
FullForm
.
EXAMPLES
CLOSE ALL
Basic Examples
(1)
Find the number of "leaves" in an expression tree:
In[1]:=
Out[1]=
In[2]:=
Out[2]=
Applications
(3)
Properties & Relations
(1)
Possible Issues
(4)
SEE ALSO
ByteCount
Length
Depth
AtomQ
Hash
TUTORIALS
Expressions as Trees
Memory Management
MORE ABOUT
Expression Structure
Memory Measurement & Optimization
RELATED LINKS
NKS|Online
(
A New Kind of Science
)
New in 1
© 2008 Wolfram Research, Inc.