Array model: Difference between revisions

Jump to navigation Jump to search
36 bytes added ,  22:14, 10 September 2022
m
Text replacement - "</source>" to "</syntaxhighlight>"
(→‎Nested array theory: quote by Scholes)
m (Text replacement - "</source>" to "</syntaxhighlight>")
(One intermediate revision by the same user not shown)
Line 95: Line 95:
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.
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 <source lang=apl inline>≡</source> to find an array's depth. For example:
Most APLs provide a Depth function <syntaxhighlight lang=apl inline>≡</syntaxhighlight> to find an array's depth. For example:
<source lang=apl>
<syntaxhighlight lang=apl>
       ≡('ab' 'cde')('fg' 'hi')
       ≡('ab' 'cde')('fg' 'hi')
3
3
</source>
</syntaxhighlight>


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.
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.

Navigation menu