Level
Every subexpression of expr at the given level(s) — level 0 is expr itself.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
Level✓Level(expr, n)levels 1 through nLevel(expr, {n})level n aloneLevel(expr, {n1, n2})levels n1 through n2Level(expr, PositiveInfinity)every level, all the way to the leavesLevel(expr, {-1})every leaf, regardless of depth — Wolfram's own "leaves" shorthandTyped signatures
| Type | Package | Applies |
|---|---|---|
(any, any) -> list<any> | combinatorics | always |
Details
- Wolfram's own POST-ORDER: a node's children (recursively) come before the node itself, so
Level({1, {2, 3}, 4}, 2)is{1, 2, 3, {2, 3}, 4}—{2, 3}printed AFTER its own parts, not before them. Siblings keep their original order; only each node's position relative to its OWN descendants moves. - A negative level counts depth from the leaves (an atom has depth 1, any other expression 1 more than its deepest part):
{-1}is the leaves,{-2}the expressions one step above them, and bare-1every proper subexpression. - No 4th-argument predicate form, and no Heads option.
Examples
About
| Examples | 12 |
|---|---|
| Checked against | Wolfram Language 12 agree |
| Crosswalk | Wolfram Language |
See also: MapIndexed, Pick