Array model: Difference between revisions
Jump to navigation
Jump to search
→Depth
Miraheze>Marshall (Describe array models more generally) |
Miraheze>Adám Brudzewsky (→Depth) |
||
Line 47: | Line 47: | ||
''Main article: [[Depth]]'' | ''Main article: [[Depth]]'' | ||
The depth is the level of nesting. For example an array of simple (i.e. non-nested) scalars 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. However, for some arrays it's not so easy. An array may contain both vectors and scalars. In cases like this, the depth is | The depth is the level of nesting. For example an array of simple (i.e. non-nested) scalars 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. However, for some arrays it's not so easy. An array may contain both vectors and scalars. In cases like this, some APLs report the depth is as negative. | ||
You can find the depth of an array with the function <code>≡</code>. | |||
You can find the depth of an array with the monadic [[primitive function]] <code>≡</code>. For example: | |||
<source lang=apl> | |||
≡('ab' 'cde')('fg' 'hi') | |||
3 | |||
</source> | |||
=== Rank === | === Rank === |