120
edits
Miraheze>Adám Brudzewsky No edit summary |
m (12 revisions imported: Migrate from miraheze) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 15: | Line 15: | ||
└───┴───┴────┘ | └───┴───┴────┘ | ||
</source> | </source> | ||
In some languages, such as [[ | In some languages, such as [[J]] and [[Dyalog APL 17.0]] and later, Unique applies to the [[major cells]] of an array, including those with rank greater than 1: | ||
<source lang=apl> | <source lang=apl> | ||
⊢x ← (⍳10)∘.∨2 3 6 | ⊢x ← (⍳10)∘.∨2 3 6 | ||
Line 41: | Line 41: | ||
To construct the Unique of an array, the major cells are considered in order of increasing [[index]]. Each cell is included if it does not [[match]] any cell which was already included. | To construct the Unique of an array, the major cells are considered in order of increasing [[index]]. Each cell is included if it does not [[match]] any cell which was already included. | ||
The array matching is subject to [[tolerant comparison]]. In the intolerant case, that is, when equality is [ | The array matching is subject to [[tolerant comparison]]. In the intolerant case, that is, when equality is [[wikipedia:Transitive_relation|transitive]], a cell is included if and only if it does not match any other cell which appears earlier in the array. That's because all the discarded duplicate cells must have matched an earlier included cell; if equality is transitive then a cell which matches the duplicate would also match the earlier cell. | ||
=== Tolerant comparison === | === Tolerant comparison === | ||
Line 95: | Line 95: | ||
=== Documentation === | === Documentation === | ||
* [http://help.dyalog.com/latest/ | * [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Unique.htm Dyalog] | ||
* [http://microapl.com/apl_help/ch_020_020_392.htm APLX] | * [http://microapl.com/apl_help/ch_020_020_392.htm APLX] |