This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 BUILT-IN MATHEMATICA SYMBOL Tutorials »| See Also »|More About »

# LeafCount

 LeafCount[expr]gives the total number of indivisible subexpressions in expr.
• LeafCount gives a measure of the total "size" of an expression.
• LeafCount counts the number of subexpressions in expr that correspond to "leaves" on the expression tree.
Find the number of "leaves" in an expression tree:
Find the number of "leaves" in an expression tree:
 Out[1]=
 Out[2]=
 Applications   (3)
Find leafcount measures of the sizes of successive integrals:
Make Simplify pick expressions with minimum LeafCount:
Find leafcounts in combinator expressions
LeafCount includes the head and all elements inside it:
LeafCount is based on the FullForm of expressions:
LeafCount counts elements in rational and complex numbers just as in FullForm:
Integers of any size are still treated as single expression leaves:
LeafCount treats SparseArray objects as single expression leaves:
Unlike TreeForm, LeafCount takes into consideration the structure of expression heads:
This shows the expression tree whose leaves are counted by LeafCount:
New in 1