Unique: Difference between revisions

Jump to navigation Jump to search
37 bytes added ,  05:52, 9 June 2020
m
Text replacement - " ⊢( *[^∘])" to " ⎕←$1"
m (Text replacement - "{{APL built-ins}}" to "{{APL built-ins}}Category:Primitive functions")
m (Text replacement - " ⊢( *[^∘])" to " ⎕←$1")
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Built-in|Unique|∪}}, or '''Nub''', is a [[monadic]] [[set function]] which removes duplicate [[major cells]] from an array. It returns only the distinct cells (those which do not [[match]] an earlier distinct cell) in the order they appeared in the array.
{{Built-ins|Unique|∪|↑}}, or '''Nub''', is a [[monadic]] [[set function]] which removes duplicate [[major cells]] from an array. It returns only the distinct cells (those which do not [[match]] an earlier distinct cell) in the order they appeared in the array.


== Examples ==
== Examples ==
Line 17: Line 17:
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:
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
1 1 1
1 1 1
2 1 2
2 1 2
Line 49: Line 49:
       ⎕CT←1e¯14
       ⎕CT←1e¯14
       ⎕PP←18 ⍝ Print all digits
       ⎕PP←18 ⍝ Print all digits
       ⊢x←1+⎕CT×0 0.6 1.2
       ⎕←x←1+⎕CT×0 0.6 1.2
1 1.000000000000006 1.000000000000012
1 1.000000000000006 1.000000000000012
       ⍳⍨x    ⍝ Each element equal to the previous
       ⍳⍨x    ⍝ Each element equal to the previous
Line 111: Line 111:
== References ==
== References ==
<references />
<references />
{{APL built-ins}}[[Category:Primitive functions]]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Set functions]]

Navigation menu