Minor updates to example script

This commit is contained in:
Nocturn9x 2022-11-09 12:55:14 +01:00
parent 09b73c35e6
commit 11448193ea
3 changed files with 6 additions and 27 deletions

View File

@ -38,7 +38,7 @@ echo queue.pop(queue.high()) # 2
echo queue.pop(^1) # 1 echo queue.pop(^1) # 1
# Pops element at position 2 # Pops element at position 2
echo queue.pop(2) echo queue.pop(2) # 0
# Supports iteration # Supports iteration
for i, e in queue: for i, e in queue:
@ -61,8 +61,8 @@ echo 0 in queue # true
# queue, the higher the time it takes to retrieve it. For # queue, the higher the time it takes to retrieve it. For
# fast random access, seqs should be used instead # fast random access, seqs should be used instead
echo queue[0] # -1 echo queue[0] # -1
echo queue[^1] # 2 echo queue[^1] # 1
echo queue[queue.high()] # 2 echo queue[queue.high()] # 1
# It's possible to extend a deque with other deques or with seqs # It's possible to extend a deque with other deques or with seqs

View File

@ -15,26 +15,5 @@ import private/queues/linked
# Exports linked queue stuff # Exports linked queue stuff
export newLinkedDeque export linked
export LinkedDeque
export add
export addLeft
export contains
export items
export reversed
export len
export linked.high
export pop
export `[]`
export `[]=`
export `==`
export pairs
export linked.`$`
export insert
export extend
export reversedPairs
export clear
export clearPop
export extendLeft
export maxSize
export find

View File

@ -170,7 +170,7 @@ proc clear*[T](self: LinkedDeque[T]) =
proc clearPop*[T](self: LinkedDeque[T]) = proc clearPop*[T](self: LinkedDeque[T]) =
## Clears the deque by repeatedly ## Clears the deque by repeatedly
## calling self.pop() in O(1) time, ## calling self.pop() in O(n) time,
## slower than clear() ## slower than clear()
while self.len() > 0: while self.len() > 0:
discard self.pop() discard self.pop()