each{                  ⍝ Fast each for pure operand function.
    vec←,⍵              ⍝ vector of
    nub←∪vec            ⍝   unique items.
    res←⍺⍺¨nub          ⍝ vector of unique results.
    (⍴⍵)res[nubvec]   ⍝ resulting array.
}
code_colours

test script

Back to: notes

Back to: Workspaces