From dbcc992006919d277c6f3c5980598d9f45cbd21d Mon Sep 17 00:00:00 2001 From: Nocturn9x Date: Tue, 15 Mar 2022 17:40:34 +0100 Subject: [PATCH] Added extendLeft --- src/private/queues/linked.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/private/queues/linked.nim b/src/private/queues/linked.nim index f2072b3..6348876 100644 --- a/src/private/queues/linked.nim +++ b/src/private/queues/linked.nim @@ -304,6 +304,20 @@ proc extend*[T](self: LinkedDeque[T], other: seq[T]) = self.add(item) +proc extendLeft*[T](self: LinkedDeque[T], other: LinkedDeque[T]) = + ## Same as self.extend(), but extends from + ## the head instead of the tail + for item in other: + self.addLeft(item) + + +proc extendLeft*[T](self: LinkedDeque[T], other: seq[T]) = + ## Same as self.extend(), but extends from + ## the head instead of the tail + for item in other: + self.addLeft(item) + + proc `$`*[T](self: LinkedDeque[T]): string = ## Returns a string representation ## of the deque