Implementation | Index << >> |
[The] nub is found by selecting the leading item, suppressing from the argument all items tolerantly [matching] it, selecting the next remaining item, and so on. uniq1 ← {1≥≢⍵:⍵ ⋄ (0⌷⍵)⍪∇⍵⌿⍨⍵≢⍤¯1 999⊢0⌷⍵} uniq1v ← {1≥≢⍵:⍵ ⋄ (⊃⍵)⍪∇⍵⌿⍨⍵≠⊃⍵} ⍝ vector case uniq1 UD x←rand 666 1 uniq1 UD 3/⍪x 1 uniq1 UT 0 assertion failure UT[4] assert 2.5≥(+⌿÷≢)2÷⍨/t←⍵ time¨1000×1 2 4 8: ∧ t 0.0143438 0.0550937 0.214625 0.84 2 ÷⍨/ t 3.84096 3.89563 3.9138 |