Skip to content

Commit

Permalink
Renamed addMove to addMoved; renamed arguments according to the s…
Browse files Browse the repository at this point in the history
…tyle guide.
  • Loading branch information
salvipeter committed Dec 18, 2020
1 parent 7538244 commit 37f6299
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
- Added `lists.copy` for shallow copying singly- and doubly linked lists.

- `add` is now overloaded also for the concatenation of singly- and doubly linked lists;
an O(1) variation that consumes its argument, `addMove`, is also supplied.
an O(1) variation that consumes its argument, `addMoved`, is also supplied.

## Language changes

Expand Down
8 changes: 4 additions & 4 deletions lib/pure/collections/lists.nim
Original file line number Diff line number Diff line change
Expand Up @@ -704,15 +704,15 @@ proc add*[T](L1: var DoublyLinkedList[T], L2: DoublyLinkedList[T]) {.since: (1,
## Appends a shallow copy of `L2` to the end of `L1`.
runnableExamples:
import sequtils
var a = [1, 2, 3].toDoublyLinkedList
let b = [4, 5].toDoublyLinkedList
var a = [1, 2, 3].toSinglyLinkedList
let b = [4, 5].toSinglyLinkedList
a.add b
assert a.toSeq == [1, 2, 3, 4, 5]
assert b.toSeq == [4, 5]
a.add a
assert a.toSeq == [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
var tmp = L2.copy
L1.addMove tmp
var tmp = b.copy
a.addMoved tmp

proc remove*[T](L: var DoublyLinkedList[T], n: DoublyLinkedNode[T]) =
## Removes a node `n` from `L`. Efficiency: O(1).
Expand Down

0 comments on commit 37f6299

Please sign in to comment.