Empty array: Difference between revisions
Jump to navigation
Jump to search
Miraheze>Adám Brudzewsky |
Miraheze>Adám Brudzewsky |
||
Line 45: | Line 45: | ||
== Reduction over a length-0 axis == | == Reduction over a length-0 axis == | ||
If a [[reduce|reduction]] (using one of <source lang=apl inline>/</source>, <source lang=apl inline>⌿</source>, <source lang=apl inline>\</source>, or <source lang=apl inline>⍀</source>)is performed over an axis of length 0, the resulting array is filled with [[identity element]]s. For example, the sum of an empty list is 0 because the identity element for [[addition]] is 0: | If a [[reduce|reduction]] (using one of <source lang=apl inline>/</source>, <source lang=apl inline>⌿</source>, <source lang=apl inline>\</source>, or <source lang=apl inline>⍀</source>) is performed over an axis of length 0, the resulting array is filled with [[identity element]]s. For example, the sum of an empty list is <source lang=apl inline>0</source> because the identity element for [[addition]] is <source lang=apl inline>0</source>: | ||
<source lang=apl> | <source lang=apl> | ||
+/0⍴0 | +/0⍴0 |