Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Expressions > Expression Structure >

Depth

Depth[expr]
gives the maximum number of indices needed to specify any part of expr, plus one.
  • Raw objects have depth 1.
  • The computation of Depth does not include heads of expressions.
Depth works on any expression, not just lists:
Depth does not distinguish heads:
All numbers have depth 1:
Find how deeply nested results from integrals are:
Find the depths of combinator expressions [more info]:
Depth gives the length of the maximum index, plus 1:
Successive elements from NestList have larger depths:
Depth does not count depth in the head:
New in 1 | Last modified in 5
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team