Nub Sieve: Difference between revisions

Jump to navigation Jump to search
280 bytes added ,  14:35, 14 July 2020
m
Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com"
Miraheze>Adám Brudzewsky
m (Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com")
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Primitive|≠|Nub Sieve}}, '''Nubsieve''', or '''Unique Mask''', is a [[monadic function]] that returns a [[Boolean]] [[vector]] indicating which [[major cells]] of its argument would be included in the result of [[Unique]] (Nub). More precisely, it indicates all cells which do not [[match]] any earlier indicated cell. The Nub Sieve is more informative than Unique because it encodes not only which cells are unique but where they appear in the argument. This means it can be used for tasks such as filtering secondary arrays and working with duplicates that are difficult to do with Unique and slow to compute with [[Key]].
{{Built-in|Nub Sieve|≠}}, '''Nubsieve''', or '''Unique Mask''', is a [[monadic function]] that returns a [[Boolean]] [[vector]] indicating which [[major cells]] of its argument would be included in the result of [[Unique]] (Nub). More precisely, it indicates all cells which do not [[match]] any earlier indicated cell. The Nub Sieve is more informative than Unique because it encodes not only which cells are unique but where they appear in the argument. This means it can be used for tasks such as filtering secondary arrays and working with duplicates that are difficult to do with Unique and slow to compute with [[Key]].


== Examples ==
== Examples ==
Line 20: Line 20:
Nub Sieve can be used to filter a [[matrix]] by some of its columns, or find its unique rows.
Nub Sieve can be used to filter a [[matrix]] by some of its columns, or find its unique rows.
<source lang=apl>
<source lang=apl>
       a ← (⍳6) ∘.! 3+⍳3
       ⎕← a ← (⍳6) ∘.! 3+⍳3
4  5  6
4  5  6
6 10 15
6 10 15
Line 87: Line 87:
== History ==
== History ==


Nub Sieve is present in [[SHARP APL]] and [[A Dictionary of APL]] as <source lang=apl inline>≠</source> or Nubsieve and [https://code.jsoftware.com/wiki/Vocabulary/tildeco in J] as <source lang=j inline>~:</source> or Nub Sieve.
:''See also [[Unique#History]].''
 
Nubsieve (<source lang=apl inline>≠</source>) first appeared in [[A Dictionary of APL]] in 1987, and was eventually added to [[SHARP APL]]. It appears [https://code.jsoftware.com/wiki/Vocabulary/tildeco in J] as <source lang=j inline>~:</source> or Nub Sieve. It is also included in [[Dyalog APL 18.0]], released June 2020.


== External links ==
== External links ==
Line 93: Line 95:
=== Documentation ===
=== Documentation ===


* [https://help.dyalog.com/18.0/#Language/Primitive%20Functions/Unique%20Mask.htm Dyalog]
* J [https://www.jsoftware.com/help/dictionary/d222.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/tildeco NuVoc] (as <source lang=j inline>~:</source>)
* J [https://www.jsoftware.com/help/dictionary/d222.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/tildeco NuVoc] (as <source lang=j inline>~:</source>)


{{APL built-ins}}
{{APL built-ins}}[[Category:Primitive functions]][[Category:Set functions]]

Navigation menu