From 476492583b5b40c184df015142afcd672b09330b Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Sat, 7 Oct 2023 04:39:32 +0800 Subject: [PATCH] remove the O(n*n) `addUnique` one from std (#22799) It's not used in the compiler, besides, it doesn't seem to be a common operation. Follows the discussion on the Discord. --- lib/pure/collections/sequtils.nim | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim index 9c33b2eb6c..a32060e183 100644 --- a/lib/pure/collections/sequtils.nim +++ b/lib/pure/collections/sequtils.nim @@ -157,18 +157,6 @@ func addUnique*[T](s: var seq[T], x: sink T) = else: s.add x -func addUnique*[T](s: var seq[T], xs: sink seq[T]) = - ## Adds any items from `xs` to the container `s` that are not already present. - ## Uses `==` to check if the item is already present. - runnableExamples: - var a = @[1, 2, 3] - a.addUnique(@[3, 4]) - a.addUnique(@[4, 5]) - assert a == @[1, 2, 3, 4, 5] - - for i in 0..high(xs): - addUnique(s, move(xs[i])) - func count*[T](s: openArray[T], x: T): int = ## Returns the number of occurrences of the item `x` in the container `s`. ##