Array model: Difference between revisions
Jump to navigation
Jump to search
→Depth
Miraheze>Marshall |
Miraheze>Marshall (→Depth) |
||
Line 71: | Line 71: | ||
{{Main|Depth}} | {{Main|Depth}} | ||
The depth is the level of nesting | The depth is the level of nesting or boxing in an array. It is defined differently in nested and flat APLs. | ||
In nested APLs, a simple non-scalar array has depth 1, an array containing only depth 1 arrays has depth 2, and a simple scalar (e.g a number or character) has depth 0. | |||
Most APLs provide a Depth function <code>≡</code> to find an array's depth. For example: | |||
<source lang=apl> | <source lang=apl> | ||
≡('ab' 'cde')('fg' 'hi') | ≡('ab' 'cde')('fg' 'hi') | ||
3 | 3 | ||
</source> | </source> | ||
APLs vary in their definition of depth: for example some may return the depth with a sign to indicate that some level of the array mixes elements of different depths. | |||
=== Rank === | === Rank === |