Identity element: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Text replacement - "<source" to "<syntaxhighlight")
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
Line 3: Line 3:
== Left and right identities ==
== Left and right identities ==


Since the identity element preserves the ''other'' argument, it can be a left and/or a right identity. For example, [[Add]] (<syntaxhighlight lang=apl inline>+</source>) has the left and right identity element <syntaxhighlight lang=apl inline>0</source> because <syntaxhighlight lang=apl inline>N≡N+0</source> and <syntaxhighlight lang=apl inline>N≡0+N</source> for all arrays <syntaxhighlight lang=apl inline>N</source> in the domain of <syntaxhighlight lang=apl inline>+</source>. However, the identity of [[Divide]] (<syntaxhighlight lang=apl inline>÷</source>), <syntaxhighlight lang=apl inline>1</source>, is only a right identity because while <syntaxhighlight lang=apl inline>N≡N÷1</source> is true for all <syntaxhighlight lang=apl inline>N</source> in the domain of <syntaxhighlight lang=apl inline>÷</source>, this isn't so for <syntaxhighlight lang=apl inline>N≡1÷N</source>, and no alternative identity element value exists which would fulfil the condition.
Since the identity element preserves the ''other'' argument, it can be a left and/or a right identity. For example, [[Add]] (<syntaxhighlight lang=apl inline>+</syntaxhighlight>) has the left and right identity element <syntaxhighlight lang=apl inline>0</syntaxhighlight> because <syntaxhighlight lang=apl inline>N≡N+0</syntaxhighlight> and <syntaxhighlight lang=apl inline>N≡0+N</syntaxhighlight> for all arrays <syntaxhighlight lang=apl inline>N</syntaxhighlight> in the domain of <syntaxhighlight lang=apl inline>+</syntaxhighlight>. However, the identity of [[Divide]] (<syntaxhighlight lang=apl inline>÷</syntaxhighlight>), <syntaxhighlight lang=apl inline>1</syntaxhighlight>, is only a right identity because while <syntaxhighlight lang=apl inline>N≡N÷1</syntaxhighlight> is true for all <syntaxhighlight lang=apl inline>N</syntaxhighlight> in the domain of <syntaxhighlight lang=apl inline>÷</syntaxhighlight>, this isn't so for <syntaxhighlight lang=apl inline>N≡1÷N</syntaxhighlight>, and no alternative identity element value exists which would fulfil the condition.


If a function <syntaxhighlight lang=apl inline>f</source> has both a left identity element and a right identity element (call them <syntaxhighlight lang=apl inline>l</source> and <syntaxhighlight lang=apl inline>r</source>), then they must be the same. This is because <syntaxhighlight lang=apl inline>l f r</source> {{←→}} <syntaxhighlight lang=apl inline>r</source>, since <syntaxhighlight lang=apl inline>l</source> is a left identity, and <syntaxhighlight lang=apl inline>l f r</source> {{←→}} <syntaxhighlight lang=apl inline>l</source>, since <syntaxhighlight lang=apl inline>r</source> is a right identity, so <syntaxhighlight lang=apl inline>l</source> {{←→}} <syntaxhighlight lang=apl inline>r</source>.
If a function <syntaxhighlight lang=apl inline>f</syntaxhighlight> has both a left identity element and a right identity element (call them <syntaxhighlight lang=apl inline>l</syntaxhighlight> and <syntaxhighlight lang=apl inline>r</syntaxhighlight>), then they must be the same. This is because <syntaxhighlight lang=apl inline>l f r</syntaxhighlight> {{←→}} <syntaxhighlight lang=apl inline>r</syntaxhighlight>, since <syntaxhighlight lang=apl inline>l</syntaxhighlight> is a left identity, and <syntaxhighlight lang=apl inline>l f r</syntaxhighlight> {{←→}} <syntaxhighlight lang=apl inline>l</syntaxhighlight>, since <syntaxhighlight lang=apl inline>r</syntaxhighlight> is a right identity, so <syntaxhighlight lang=apl inline>l</syntaxhighlight> {{←→}} <syntaxhighlight lang=apl inline>r</syntaxhighlight>.


== Reduction over a length-0 axis ==
== Reduction over a length-0 axis ==


If a [[reduce|reduction]] (using one of <syntaxhighlight lang=apl inline>/</source>, <syntaxhighlight lang=apl inline>⌿</source>, <syntaxhighlight lang=apl inline>\</source>, or <syntaxhighlight lang=apl inline>⍀</source>) is performed over an axis of length 0, the resulting array is filled with identity elements. For example, the sum of an empty list is <syntaxhighlight lang=apl inline>0</source>, while the columnar sum of a two-column [[matrix]] with no rows is <syntaxhighlight lang=apl inline>0 0</source>:
If a [[reduce|reduction]] (using one of <syntaxhighlight lang=apl inline>/</syntaxhighlight>, <syntaxhighlight lang=apl inline>⌿</syntaxhighlight>, <syntaxhighlight lang=apl inline>\</syntaxhighlight>, or <syntaxhighlight lang=apl inline>⍀</syntaxhighlight>) is performed over an axis of length 0, the resulting array is filled with identity elements. For example, the sum of an empty list is <syntaxhighlight lang=apl inline>0</syntaxhighlight>, while the columnar sum of a two-column [[matrix]] with no rows is <syntaxhighlight lang=apl inline>0 0</syntaxhighlight>:
<syntaxhighlight lang=apl>
<syntaxhighlight lang=apl>
       +/0⍴0
       +/0⍴0
Line 15: Line 15:
       +/0 2⍴0
       +/0 2⍴0
0 0
0 0
</source>
</syntaxhighlight>


== Support ==
== Support ==
Line 21: Line 21:
Dialects differ in their support for such reductions. All define identity elements for most scalar primitives, and some stop there (e.g. SAX), while others (e.g. Dyalog APL and APL2) define identity elements for various mixed functions.  
Dialects differ in their support for such reductions. All define identity elements for most scalar primitives, and some stop there (e.g. SAX), while others (e.g. Dyalog APL and APL2) define identity elements for various mixed functions.  


The identity element value for each function is defined in terms of the [[prototype]] <syntaxhighlight lang=apl inline>P</source> of the array <syntaxhighlight lang=apl inline>Y</source>:
The identity element value for each function is defined in terms of the [[prototype]] <syntaxhighlight lang=apl inline>P</syntaxhighlight> of the array <syntaxhighlight lang=apl inline>Y</syntaxhighlight>:
{| class=wikitable
{| class=wikitable
! Function name || [[Glyph]] || Value || Left || Right || Notes
! Function name || [[Glyph]] || Value || Left || Right || Notes
|-
|-
| [[Add]] || <syntaxhighlight lang=apl inline>+</source> || <syntaxhighlight lang=apl inline>0</source> || {{Yes}} || {{Yes}} ||
| [[Add]] || <syntaxhighlight lang=apl inline>+</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> || {{Yes}} || {{Yes}} ||
|-
|-
| [[Subtract]] || <syntaxhighlight lang=apl inline>-</source> || <syntaxhighlight lang=apl inline>0</source> || {{No}} || {{Yes}} ||
| [[Subtract]] || <syntaxhighlight lang=apl inline>-</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> || {{No}} || {{Yes}} ||
|-
|-
| [[Multiply]] || <syntaxhighlight lang=apl inline>×</source> || <syntaxhighlight lang=apl inline>1</source> || {{Yes}} || {{Yes}} ||
| [[Multiply]] || <syntaxhighlight lang=apl inline>×</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{Yes}} || {{Yes}} ||
|-
|-
| [[Divide]] || <syntaxhighlight lang=apl inline>÷</source> || <syntaxhighlight lang=apl inline>1</source> || {{No}} || {{Yes}} ||
| [[Divide]] || <syntaxhighlight lang=apl inline>÷</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{No}} || {{Yes}} ||
|-
|-
| [[Residue]] || <syntaxhighlight lang=apl inline>|</source> || <syntaxhighlight lang=apl inline>0</source> || {{Yes}} || {{No}} ||
| [[Residue]] || <syntaxhighlight lang=apl inline>|</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> || {{Yes}} || {{No}} ||
|-
|-
| [[Minimum]] || <syntaxhighlight lang=apl inline>⌊</source> || <syntaxhighlight lang=apl inline>∞</source> || {{Yes}} || {{Yes}} || the maximum representable number
| [[Minimum]] || <syntaxhighlight lang=apl inline>⌊</syntaxhighlight> || <syntaxhighlight lang=apl inline>∞</syntaxhighlight> || {{Yes}} || {{Yes}} || the maximum representable number
|-
|-
| [[Maximum]] || <syntaxhighlight lang=apl inline>⌈</source> || <syntaxhighlight lang=apl inline>-∞</source> || {{Yes}} || {{Yes}} || the minimum representable number
| [[Maximum]] || <syntaxhighlight lang=apl inline>⌈</syntaxhighlight> || <syntaxhighlight lang=apl inline>-∞</syntaxhighlight> || {{Yes}} || {{Yes}} || the minimum representable number
|-
|-
| [[Power]] || <syntaxhighlight lang=apl inline>*</source> || <syntaxhighlight lang=apl inline>1</source> || {{No}} || {{Yes}} ||
| [[Power]] || <syntaxhighlight lang=apl inline>*</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{No}} || {{Yes}} ||
|-
|-
| [[Circle function]] || <syntaxhighlight lang=apl inline>○</source> || <syntaxhighlight lang=apl inline>¯9</source> || {{Yes}} || {{No}} ||  
| [[Circle function]] || <syntaxhighlight lang=apl inline>○</syntaxhighlight> || <syntaxhighlight lang=apl inline>¯9</syntaxhighlight> || {{Yes}} || {{No}} ||  
|-
|-
| [[Binomial]] || <syntaxhighlight lang=apl inline>!</source> || <syntaxhighlight lang=apl inline>1</source> || {{Yes}} || {{No}} ||
| [[Binomial]] || <syntaxhighlight lang=apl inline>!</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{Yes}} || {{No}} ||
|-
|-
| [[Root]] || <syntaxhighlight lang=apl inline>√</source> || <syntaxhighlight lang=apl inline>1</source> || {{Yes}} || {{No}} ||
| [[Root]] || <syntaxhighlight lang=apl inline>√</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{Yes}} || {{No}} ||
|-
|-
| [[And]]/[[LCM]] || <syntaxhighlight lang=apl inline>∧</source> || <syntaxhighlight lang=apl inline>1</source> || {{Yes}} || {{Yes}} ||
| [[And]]/[[LCM]] || <syntaxhighlight lang=apl inline>∧</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{Yes}} || {{Yes}} ||
|-
|-
| [[Or]]/[[GCD]] || <syntaxhighlight lang=apl inline>∨</source> || <syntaxhighlight lang=apl inline>0</source> || {{Yes}} || {{Yes}} || Non-negative reals only
| [[Or]]/[[GCD]] || <syntaxhighlight lang=apl inline>∨</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> || {{Yes}} || {{Yes}} || Non-negative reals only
|-
|-
| [[Less]] || <syntaxhighlight lang=apl inline><</source> || <syntaxhighlight lang=apl inline>0</source> || {{Yes}} || {{No}} || [[Boolean]]s only
| [[Less]] || <syntaxhighlight lang=apl inline><</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> || {{Yes}} || {{No}} || [[Boolean]]s only
|-
|-
| [[Less Or Equal]] || <syntaxhighlight lang=apl inline>≤</source> || <syntaxhighlight lang=apl inline>1</source> || {{Yes}} || {{No}} || [[Boolean]]s only
| [[Less Or Equal]] || <syntaxhighlight lang=apl inline>≤</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{Yes}} || {{No}} || [[Boolean]]s only
|-
|-
| [[Equal to]] || <syntaxhighlight lang=apl inline>=</source> || <syntaxhighlight lang=apl inline>1</source> || {{Yes}} || {{Yes}} || [[Boolean]]s only
| [[Equal to]] || <syntaxhighlight lang=apl inline>=</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{Yes}} || {{Yes}} || [[Boolean]]s only
|-
|-
| [[Greater Or Equal]] || <syntaxhighlight lang=apl inline>≥</source> || <syntaxhighlight lang=apl inline>1</source> || {{No}} || {{Yes}} || [[Boolean]]s only
| [[Greater Or Equal]] || <syntaxhighlight lang=apl inline>≥</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{No}} || {{Yes}} || [[Boolean]]s only
|-
|-
| [[Greater]] || <syntaxhighlight lang=apl inline>></source> || <syntaxhighlight lang=apl inline>0</source> || {{No}} || {{Yes}} || [[Boolean]]s only
| [[Greater]] || <syntaxhighlight lang=apl inline>></syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> || {{No}} || {{Yes}} || [[Boolean]]s only
|-
|-
| [[Not Equal]] || <syntaxhighlight lang=apl inline>≠</source> || <syntaxhighlight lang=apl inline>0</source> || {{Yes}} || {{Yes}} || [[Boolean]]s only
| [[Not Equal]] || <syntaxhighlight lang=apl inline>≠</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> || {{Yes}} || {{Yes}} || [[Boolean]]s only
|-
|-
| [[Reshape]] || <syntaxhighlight lang=apl inline>⍴</source> || <syntaxhighlight lang=apl inline>⍴P</source> || {{Yes}} || {{No}} ||
| [[Reshape]] || <syntaxhighlight lang=apl inline>⍴</syntaxhighlight> || <syntaxhighlight lang=apl inline>⍴P</syntaxhighlight> || {{Yes}} || {{No}} ||
|-
|-
| [[Catenate]] || <syntaxhighlight lang=apl inline>,</source> || <syntaxhighlight lang=apl inline>P⍴⍨ρ∘⊂⍨0,⍨¯1↓ρP</source> || {{Yes}} || {{No}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</source>
| [[Catenate]] || <syntaxhighlight lang=apl inline>,</syntaxhighlight> || <syntaxhighlight lang=apl inline>P⍴⍨ρ∘⊂⍨0,⍨¯1↓ρP</syntaxhighlight> || {{Yes}} || {{No}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</syntaxhighlight>
|-
|-
| [[Rotate]] || <syntaxhighlight lang=apl inline>⌽</source> || <syntaxhighlight lang=apl inline>0</source> or <syntaxhighlight lang=apl inline>0⍴⍨¯1↓⍴P</source> || {{Yes}} || {{No}} ||
| [[Rotate]] || <syntaxhighlight lang=apl inline>⌽</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> or <syntaxhighlight lang=apl inline>0⍴⍨¯1↓⍴P</syntaxhighlight> || {{Yes}} || {{No}} ||
|-
|-
| [[Rotate First]] || <syntaxhighlight lang=apl inline>⊖</source> || <syntaxhighlight lang=apl inline>0</source> or <syntaxhighlight lang=apl inline>0⍴⍨1↓⍴P</source>  || {{Yes}} || {{No}} ||
| [[Rotate First]] || <syntaxhighlight lang=apl inline>⊖</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> or <syntaxhighlight lang=apl inline>0⍴⍨1↓⍴P</syntaxhighlight>  || {{Yes}} || {{No}} ||
|-
|-
| [[Transpose]] || <syntaxhighlight lang=apl inline>⍉</source> || <syntaxhighlight lang=apl inline>⍳≢⍴P</source> || {{Yes}} || {{No}} ||
| [[Transpose]] || <syntaxhighlight lang=apl inline>⍉</syntaxhighlight> || <syntaxhighlight lang=apl inline>⍳≢⍴P</syntaxhighlight> || {{Yes}} || {{No}} ||
|-
|-
| [[Pick]] || <syntaxhighlight lang=apl inline>⊃</source> || <syntaxhighlight lang=apl inline>⍬</source> || {{Yes}} || {{No}} ||
| [[Pick]] || <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> || <syntaxhighlight lang=apl inline>⍬</syntaxhighlight> || {{Yes}} || {{No}} ||
|-
|-
| [[Drop]] || <syntaxhighlight lang=apl inline>↓</source> || <syntaxhighlight lang=apl inline>⍬</source> or <syntaxhighlight lang=apl inline>0×⍴P</source> || {{Yes}} || {{No}} ||
| [[Drop]] || <syntaxhighlight lang=apl inline>↓</syntaxhighlight> || <syntaxhighlight lang=apl inline>⍬</syntaxhighlight> or <syntaxhighlight lang=apl inline>0×⍴P</syntaxhighlight> || {{Yes}} || {{No}} ||
|-
|-
| [[Take]] || <syntaxhighlight lang=apl inline>↑</source> || <syntaxhighlight lang=apl inline>⍬</source> or <syntaxhighlight lang=apl inline>⍴P</source>|| {{Yes}} || {{No}} ||
| [[Take]] || <syntaxhighlight lang=apl inline>↑</syntaxhighlight> || <syntaxhighlight lang=apl inline>⍬</syntaxhighlight> or <syntaxhighlight lang=apl inline>⍴P</syntaxhighlight>|| {{Yes}} || {{No}} ||
|-
|-
| [[Squad Index]] || <syntaxhighlight lang=apl inline>⌷</source> || <syntaxhighlight lang=apl inline>⍬</source> or <syntaxhighlight lang=apl inline>⍳¨⍴P</source>|| {{Yes}} || {{No}} ||
| [[Squad Index]] || <syntaxhighlight lang=apl inline>⌷</syntaxhighlight> || <syntaxhighlight lang=apl inline>⍬</syntaxhighlight> or <syntaxhighlight lang=apl inline>⍳¨⍴P</syntaxhighlight>|| {{Yes}} || {{No}} ||
|-
|-
| [[Without]] || <syntaxhighlight lang=apl inline>~</source> || <syntaxhighlight lang=apl inline>0⌿P</source> || {{No}} || {{Yes}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</source>
| [[Without]] || <syntaxhighlight lang=apl inline>~</syntaxhighlight> || <syntaxhighlight lang=apl inline>0⌿P</syntaxhighlight> || {{No}} || {{Yes}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</syntaxhighlight>
|-
|-
| [[Matrix Divide]] || <syntaxhighlight lang=apl inline>⌹</source> || <syntaxhighlight lang=apl inline>∘.=⍨⍳≢P</source> || {{No}} || {{Yes}} ||
| [[Matrix Divide]] || <syntaxhighlight lang=apl inline>⌹</syntaxhighlight> || <syntaxhighlight lang=apl inline>∘.=⍨⍳≢P</syntaxhighlight> || {{No}} || {{Yes}} ||
|-
|-
| [[Encode]] || <syntaxhighlight lang=apl inline>⊤</source> || <syntaxhighlight lang=apl inline>0</source> || {{No}} || {{Yes}} ||
| [[Encode]] || <syntaxhighlight lang=apl inline>⊤</syntaxhighlight> || <syntaxhighlight lang=apl inline>0</syntaxhighlight> || {{No}} || {{Yes}} ||
|-
|-
| [[Union]] || <syntaxhighlight lang=apl inline>∪</source> || <syntaxhighlight lang=apl inline>0⌿P</source> || {{Yes}} || {{Yes}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</source>
| [[Union]] || <syntaxhighlight lang=apl inline>∪</syntaxhighlight> || <syntaxhighlight lang=apl inline>0⌿P</syntaxhighlight> || {{Yes}} || {{Yes}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</syntaxhighlight>
|-
|-
| [[Replicate]] || <syntaxhighlight lang=apl inline>/</source> || <syntaxhighlight lang=apl inline>1</source> || {{Yes}} || {{No}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</source>
| [[Replicate]] || <syntaxhighlight lang=apl inline>/</syntaxhighlight> || <syntaxhighlight lang=apl inline>1</syntaxhighlight> || {{Yes}} || {{No}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</syntaxhighlight>
|-
|-
| [[Expand]] || <syntaxhighlight lang=apl inline>\</source> || <syntaxhighlight lang=apl inline>∘.=⍨⍳≢P</source> || {{Yes}} || {{No}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</source>
| [[Expand]] || <syntaxhighlight lang=apl inline>\</syntaxhighlight> || <syntaxhighlight lang=apl inline>∘.=⍨⍳≢P</syntaxhighlight> || {{Yes}} || {{No}} || <syntaxhighlight lang=apl inline>1≤≢⍴Y</syntaxhighlight>
|-
|-
| [[Inner product]]s || <syntaxhighlight lang=apl inline>+.×</source><br><syntaxhighlight lang=apl inline>∨.∧</source> || <syntaxhighlight lang=apl inline>∘.=⍨⍳≢P</source> || {{Yes}} || {{Yes}} ||
| [[Inner product]]s || <syntaxhighlight lang=apl inline>+.×</syntaxhighlight><br><syntaxhighlight lang=apl inline>∨.∧</syntaxhighlight> || <syntaxhighlight lang=apl inline>∘.=⍨⍳≢P</syntaxhighlight> || {{Yes}} || {{Yes}} ||
|-
|-
| [[Inner product]] || <syntaxhighlight lang=apl inline>∧.∨</source> || <syntaxhighlight lang=apl inline>∘.≠⍨⍳≢P</source> || {{Yes}} || {{Yes}} ||
| [[Inner product]] || <syntaxhighlight lang=apl inline>∧.∨</syntaxhighlight> || <syntaxhighlight lang=apl inline>∘.≠⍨⍳≢P</syntaxhighlight> || {{Yes}} || {{Yes}} ||
|}
|}



Latest revision as of 22:14, 10 September 2022

The identity element for a dyadic function is a value inherent to that function. It is defined as the value which would preserve the other argument of the dyadic function application, possibly only for a well-defined subset of the function's domain.

Left and right identities

Since the identity element preserves the other argument, it can be a left and/or a right identity. For example, Add (+) has the left and right identity element 0 because N≡N+0 and N≡0+N for all arrays N in the domain of +. However, the identity of Divide (÷), 1, is only a right identity because while N≡N÷1 is true for all N in the domain of ÷, this isn't so for N≡1÷N, and no alternative identity element value exists which would fulfil the condition.

If a function f has both a left identity element and a right identity element (call them l and r), then they must be the same. This is because l f r r, since l is a left identity, and l f r l, since r is a right identity, so l r.

Reduction over a length-0 axis

If a reduction (using one of /, , \, or ) is performed over an axis of length 0, the resulting array is filled with identity elements. For example, the sum of an empty list is 0, while the columnar sum of a two-column matrix with no rows is 0 0:

      +/0⍴0
0
      +/0 2⍴0
0 0

Support

Dialects differ in their support for such reductions. All define identity elements for most scalar primitives, and some stop there (e.g. SAX), while others (e.g. Dyalog APL and APL2) define identity elements for various mixed functions.

The identity element value for each function is defined in terms of the prototype P of the array Y:

Function name Glyph Value Left Right Notes
Add + 0 Yes Yes
Subtract - 0 No Yes
Multiply × 1 Yes Yes
Divide ÷ 1 No Yes
Residue | 0 Yes No
Minimum Yes Yes the maximum representable number
Maximum -∞ Yes Yes the minimum representable number
Power * 1 No Yes
Circle function ¯9 Yes No
Binomial ! 1 Yes No
Root 1 Yes No
And/LCM 1 Yes Yes
Or/GCD 0 Yes Yes Non-negative reals only
Less < 0 Yes No Booleans only
Less Or Equal 1 Yes No Booleans only
Equal to = 1 Yes Yes Booleans only
Greater Or Equal 1 No Yes Booleans only
Greater > 0 No Yes Booleans only
Not Equal 0 Yes Yes Booleans only
Reshape ⍴P Yes No
Catenate , P⍴⍨ρ∘⊂⍨0,⍨¯1↓ρP Yes No 1≤≢⍴Y
Rotate 0 or 0⍴⍨¯1↓⍴P Yes No
Rotate First 0 or 0⍴⍨1↓⍴P Yes No
Transpose ⍳≢⍴P Yes No
Pick Yes No
Drop or 0×⍴P Yes No
Take or ⍴P Yes No
Squad Index or ⍳¨⍴P Yes No
Without ~ 0⌿P No Yes 1≤≢⍴Y
Matrix Divide ∘.=⍨⍳≢P No Yes
Encode 0 No Yes
Union 0⌿P Yes Yes 1≤≢⍴Y
Replicate / 1 Yes No 1≤≢⍴Y
Expand \ ∘.=⍨⍳≢P Yes No 1≤≢⍴Y
Inner products +.×
∨.∧
∘.=⍨⍳≢P Yes Yes
Inner product ∧.∨ ∘.≠⍨⍳≢P Yes Yes

External links

Documentation


APL features [edit]
Built-ins Primitives (functions, operators) ∙ Quad name
Array model ShapeRankDepthBoundIndex (Indexing) ∙ AxisRavelRavel orderElementScalarVectorMatrixSimple scalarSimple arrayNested arrayCellMajor cellSubarrayEmpty arrayPrototype
Data types Number (Boolean, Complex number) ∙ Character (String) ∙ BoxNamespaceFunction array
Concepts and paradigms Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity elementComplex floorArray ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ GlyphLeading axis theoryMajor cell searchFirst-class function
Errors LIMIT ERRORRANK ERRORSYNTAX ERRORDOMAIN ERRORLENGTH ERRORINDEX ERRORVALUE ERROREVOLUTION ERROR