Rank and Count
The rank of a list value is a measure of how deeply it is nested consistently. Specifically, a list value's rank is one plus the minimum rank among all of its members. A non-list value also has a rank, which is always zero.
The count of a list value is the number of members it has at the top level (i.e., looking no more deeply than rank 1). A non-list value also has a count, which is always zero.
Value | Rank | Count |
---|---|---|
16 | 0 | 0 |
{} | 1 | 0 |
{10, 345, -11, 8, 60} | 1 | 5 |
{10, {345, -11}, 8, 60} | 1 | 4 |
{{10}, {345, -11}, 8, 60} | 1 | 4 |
{{10}, {345, -11}, {8, 60}} | 2 | 3 |
{{'red', 'purple'}, {'blue', 'green'}, {'yellow', 'orange'}} | 2 | 3 |
{{{true, false}, 3.14159}, {'Hello'}, {-11, 200}} | 2 | 3 |
{{{0, 1}, {10, 11}}, {{100, 101}, {110, 111}}} | 3 | 2 |