Depth (operator): Difference between revisions

Jump to navigation Jump to search
145 bytes added ,  14:58, 7 November 2022
(4 intermediate revisions by the same user not shown)
Line 14: Line 14:
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 sub-arrays of ⍵ (monadic) or both arguments (dyadic)
   ⍤  b c  ⍝ Depth-b cells of ⍺ and depth-c sub-arrays of ⍵ (dyadic)
   ⍤  b c  ⍝ Depth-b sub-arrays of ⍺ and depth-c sub-arrays of ⍵ (dyadic)
   ⍤a b c  ⍝ Depth-a cells of ⍵ (monadic), depth-b sub-arrays of ⍺ and depth-c sub-arrays of ⍵ (dyadic)
   ⍤a b c  ⍝ Depth-a sub-arrays of ⍵ (monadic), depth-b sub-arrays of ⍺ and depth-c sub-arrays of ⍵ (dyadic)
</syntaxhighlight>
</syntaxhighlight>


Line 44: Line 44:
└──────────┴───┘
└──────────┴───┘
</syntaxhighlight>
</syntaxhighlight>


Con[[catenate]] a constant prefix to each element:
Con[[catenate]] a constant prefix to each element:
Line 56: Line 55:
Pair up the elements on the left with each element of each element on the right.
Pair up the elements on the left with each element of each element on the right.
<syntaxhighlight lang=apl>
<syntaxhighlight lang=apl>
       'xy',⍥0 1⊢('ab' 'cd')('AB' 'CD')  ⍝ equivalent to (⊂'xy'),¨¨('ab' 'cd')('AB' 'CD')
       'xy',⍥¯1⍥¯1⊢('ab' 'cd')('AB' 'CD')  ⍝ equivalent to (⊂'xy'),¨¨('ab' 'cd')('AB' 'CD')
┌─────────┬─────────┐
┌─────────┬─────────┐
│┌───┬───┐│┌───┬───┐│
│┌───┬───┐│┌───┬───┐│
Line 70: Line 69:


=== Publications ===
=== Publications ===
* [[dfns workspace]]: [https://dfns.dyalog.com/n_Depth.htm Depth]
* [https://github.com/abrudz/primitives/blob/main/depth.aplo APL model]
* [[dfns workspace]]: [https://dfns.dyalog.com/n_Depth.htm Depth] (this model does not correspond to the final design)


{{APL built-ins}}[[Category:Primitive operators]]
{{APL built-ins}}[[Category:Primitive operators]]

Navigation menu