Per the APL Wiki article
Nub Sieve returns a 1 for each major cell in the argument that is unique, and a 0 if it's a duplicate
The article provides an implementation using other primitives, translated to Kap as follows
N ⇐ (2≠/ ̄1,⌈\∪«⍳»(1/⊢))
Which will be used for the following test case examples.
The unique mask on a vector is such that Replicating with the mask produces the same result as ∪
> a ← "abracadabra"
> a ⍪⍥< N a
┌→───────────────────────────────┐
↓@a @b @r @a @c @a @d @a @b @r @a│
│ 1 1 1 0 1 0 1 0 0 0 0│
└────────────────────────────────┘
> ((N a) ⫽ a) ≡ (∪ a)
1
At higher dimensions, such as matrices, I expect it to work on major cells.
Of note, ∪ does not work on a matrix without first converting to a vector of major cells
> ⊢ m ← ? 10 3 ⍴ 2
┌→────┐
↓1 1 1│
│1 0 0│
│1 1 0│
│1 0 0│
│1 0 1│
│1 0 0│
│1 0 1│
│1 0 1│
│0 0 0│
│0 0 1│
└─────┘
> ⊃ ∪ ,/ m
┌→────┐
↓1 1 1│
│1 0 0│
│1 1 0│
│1 0 1│
│0 0 0│
│0 0 1│
└─────┘
I'm not sure if this is a misunderstanding on my part.
In any case, I will demonstrate Unique Mask on a matrix in the same way
> m ,⍥⊂ ⍉< N ,/ m
┌→──────────┐
│┌→────┐ ┌→┐│
│↓1 1 1│ ↓1││
││1 0 0│ │1││
││1 1 0│ │1││
││1 0 0│ │0││
││1 0 1│ │1││
││1 0 0│ │0││
││1 0 1│ │0││
││1 0 1│ │0││
││0 0 0│ │1││
││0 0 1│ │1││
│└─────┘ └─┘│
└───────────┘
> ((N ,/ m) ⫽ ,/ m) ≡⍥⊃ (∪ ,/ m)
1
Per the [APL Wiki article](https://aplwiki.com/wiki/Nub_Sieve)
> Nub Sieve returns a 1 for each major cell in the argument that is unique, and a 0 if it's a duplicate
The article provides an implementation using other primitives, translated to Kap as follows
```apl
N ⇐ (2≠/ ̄1,⌈\∪«⍳»(1/⊢))
```
Which will be used for the following test case examples.
The unique mask on a vector is such that Replicating with the mask produces the same result as `∪`
```apl
> a ← "abracadabra"
> a ⍪⍥< N a
┌→───────────────────────────────┐
↓@a @b @r @a @c @a @d @a @b @r @a│
│ 1 1 1 0 1 0 1 0 0 0 0│
└────────────────────────────────┘
> ((N a) ⫽ a) ≡ (∪ a)
1
```
At higher dimensions, such as matrices, I expect it to work on major cells.
Of note, `∪` does not work on a matrix without first converting to a vector of major cells
```apl
> ⊢ m ← ? 10 3 ⍴ 2
┌→────┐
↓1 1 1│
│1 0 0│
│1 1 0│
│1 0 0│
│1 0 1│
│1 0 0│
│1 0 1│
│1 0 1│
│0 0 0│
│0 0 1│
└─────┘
> ⊃ ∪ ,/ m
┌→────┐
↓1 1 1│
│1 0 0│
│1 1 0│
│1 0 1│
│0 0 0│
│0 0 1│
└─────┘
```
I'm not sure if this is a misunderstanding on my part.
In any case, I will demonstrate Unique Mask on a matrix in the same way
```apl
> m ,⍥⊂ ⍉< N ,/ m
┌→──────────┐
│┌→────┐ ┌→┐│
│↓1 1 1│ ↓1││
││1 0 0│ │1││
││1 1 0│ │1││
││1 0 0│ │0││
││1 0 1│ │1││
││1 0 0│ │0││
││1 0 1│ │0││
││1 0 1│ │0││
││0 0 0│ │1││
││0 0 1│ │1││
│└─────┘ └─┘│
└───────────┘
> ((N ,/ m) ⫽ ,/ m) ≡⍥⊃ (∪ ,/ m)
1
```