WLJS LogoWLJS Notebook

LeafCount

LeafCount[expr] gives the total number of indivisible subexpressions (atoms) in expr.

Examples

Count atoms in an expression:

LeafCount[{1, 2, 3}]
(* 3 *)

Complex expressions:

LeafCount[a + b*c]
(* 3 *)

LeafCount[x^2 + 3*x + 1]
(* 6 *)

Please visit the official Wolfram Language Reference for more details.

On this page