Depth (operator): Difference between revisions

Jump to navigation Jump to search
6 bytes removed ,  09:04, 14 September 2022
sub-element → sub-array as per https://help.dyalog.com/latest/Content/Language/Introduction/Variables/Arrays.htm
m (Text replacement - "</source>" to "</syntaxhighlight>")
(sub-element → sub-array as per https://help.dyalog.com/latest/Content/Language/Introduction/Variables/Arrays.htm)
Line 1: Line 1:
:''This article is about the operator. See [[Depth]] for the number associated with every array and the function which returns this number.''
:''This article is about the operator. See [[Depth]] for the number associated with every array and the function which returns this number.''


{{Built-in|Depth|⍥}} is a [[primitive operator|primitive]] [[dyadic operator]] which applies its left [[operand]] function to sub-elements of its arguments specified by its right operand array. It appears in [[Extended Dyalog APL]], [[dzaima/APL]], [[J]] (as <syntaxhighlight lang=j inline>L:</syntaxhighlight>), and [[BQN]] (as <code>⚇</code>).
{{Built-in|Depth|⍥}} is a [[primitive operator|primitive]] [[dyadic operator]] which applies its left [[operand]] function to [[sub-array]]s of its arguments specified by its right operand array. It appears in [[Extended Dyalog APL]], [[dzaima/APL]], [[J]] (as <syntaxhighlight lang=j inline>L:</syntaxhighlight>), and [[BQN]] (as <code>⚇</code>).


== Introduction ==
== Introduction ==
Line 11: Line 11:


== Depth specification ==
== Depth specification ==
The right operand specifies the [[depth]] of sub-elements to which the left operand function is applied as follows:
The right operand specifies the [[depth]] of sub-arrays to which the left operand function is applied as follows:
For left argument <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and right argument <syntaxhighlight lang=apl inline>⍵</syntaxhighlight>,
For left argument <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and right argument <syntaxhighlight lang=apl inline>⍵</syntaxhighlight>,
<syntaxhighlight lang=apl>
<syntaxhighlight lang=apl>
   ⍤    c  ⍝ Depth-c cells of ⍵ (monadic) or both arguments (dyadic)
   ⍤    c  ⍝ Depth-c cells of ⍵ (monadic) or both arguments (dyadic)
   ⍤  b c  ⍝ Depth-b cells of ⍺ and depth-c sub-elements of ⍵ (dyadic)
   ⍤  b c  ⍝ Depth-b cells of ⍺ and depth-c sub-arrays of ⍵ (dyadic)
   ⍤a b c  ⍝ Depth-a cells of ⍵ (monadic), depth-b sub-elements of ⍺ and depth-c sub-elements of ⍵ (dyadic)
   ⍤a b c  ⍝ Depth-a cells of ⍵ (monadic), depth-b sub-arrays of ⍺ and depth-c sub-arrays of ⍵ (dyadic)
</syntaxhighlight>
</syntaxhighlight>


Navigation menu