Implementation | Index << >> |
Uniq←{ 0=⍴⍴⍵:,⍵ X←⍵ c←{⊂⍵}⌸ ⍺⍺ ⍵ ⍵ ⌷⍨⊂ {⍵[⍋⍵]} ∊ {1≥≢⍵:⍵ ⋄ (⊃⍵)⍪∇ ⍵⌿⍨(X⌷⍨⊂⍵)≢⍤¯1 999⊢(X⌷⍨⊃⍵)}¨ c } cluster ← {((1,2≠/s)/s←⍵[⍋⍵])⍸⍵} hd← {⍳⍨ ⍉cluster⍤1⍉ ⍵} hz← {⍳⍨ ⍉cluster⍤1⍉ |⍵} Tol (2×⎕ct) hd Uniq UD 0 rand 666 hz Uniq UD 0j1 rand 666 1 1 hd Uniq UT 0 hz Uniq UT 0j1 1 1 |