@Stefan - this is a classic application of `containsOrImpl` in the set APIs (or
`getOrPut` in the table APIs) which are very close to the core "search or
insert" hash table algorithm.
proc uniqCp[T](s: openArray[T]): seq[T] =
newSeq(result, s.len)
var h = initSet[T](rightSize(s.len))
var i = 0
for el in s:
if not h.containsOrIncl(el):
result[i] = el
inc(i)
proc uniqInPlace[T](s: var seq[T]) =
var h = initSet[T](rightSize(s.len))
var i = 0
for el in s:
if not h.containsOrIncl(el):
s[i] = el
inc(i)
s.setLen(h.len)
These were also about 20% faster on my system than their `OrderedSet`
counterparts.