summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-10-07 04:39:32 +0800
committerGitHub <noreply@github.com>2023-10-06 22:39:32 +0200
commit476492583b5b40c184df015142afcd672b09330b (patch)
treeed294177dbf44ce26a3f2d75804f9a2441ff3de7 /lib
parentf2f0b3e25d976446e657cee7157591ce587624fd (diff)
downloadNim-476492583b5b40c184df015142afcd672b09330b.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/collections/sequtils.nim12
1 files changed, 0 insertions, 12 deletions
diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim
index 9c33b2eb6..a32060e18 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`.
   ##