Skip to content

distinct

Unique items of a list

distinct x    distinct[x]

Where x is a list returns the distinct (unique) items of x in the order of their first occurrence. The result does not have the unique attribute set.

q)distinct 2 3 7 3 5 3
2 3 7 5

Returns the distinct rows of a table.

q)distinct flip `a`b`c!(1 2 1;2 3 2;"aba")
a b c
-----
1 2 a
2 3 b

It does not use comparison tolerance

q)\P 14
q)distinct 2 + 0f,10 xexp -13
2 2.0000000000001

Errors

error cause
rank x is an atom

.Q.fu (apply unique)
Precision, Search