Types
EmptySkipListError {....deprecated.} = SkipListEmptyError
- Source Edit Alias for SkipListEmptyError
SkipList[T] = ref SkipListObj[T]
- Source Edit
SkipListCmp[T] = proc (a, b: SkipList[T]): cmp {.noSideEffect.}
- The procedure signature to use for comparing two SkipLists. Source Edit
SkipListDefect = object of AssertionDefect
- A defect was detected in the SkipList implementation. Source Edit
SkipListEmptyError = object of ValueError
- An empty SkipList is invalid for this operation. Source Edit
SkipListError = object of IndexDefect
- A specified index that should have existed did not. Source Edit
SkipListFind[T] = proc (a: SkipList[T]): cmp {.noSideEffect.}
- The procedure signature to use for finding one SkipList. Source Edit
SkipListObj[T] = object over: SkipList[T] down: SkipList[T] value*: T
- Source Edit
SkipListPred[T] = proc (up: SkipList[T]; here: SkipList[T]; child: SkipList[T]): bool
-
The predicate used to determine whether the SkipList will grow during an add() operation.
Source Editup: a larger scope of the SkipList, perhaps top-most here: a narrower scope of the SkipList child: a SkipList holding the new value
Procs
func `===`(a, b: SkipList): bool
- true if SkipLists a and b share the same memory, else false. Source Edit
proc `==`[T](s: SkipList[T]; q: openArray[T]): bool
- true if SkipList s holds the same values as openArray q. Source Edit
proc add[T](s: var SkipList[T]; v: T; pred: SkipListPred[T] = defaultPred)
- Add a value v into SkipList s. Source Edit
proc bottom(s: SkipList): SkipList
- Traverse to the longest SkipList, which holds all values. Source Edit
proc contains[T](s: SkipList[T]; v: T): bool
-
true if the SkipList s contains value v.
Example:
var s: SkipList[int] assert 5 notin s s.add 5 s.add 9 assert 9 in s assert 5 in s
Source Edit proc count(s: SkipList): int
-
Count the number of entries in SkipList s.
Example:
var s: SkipList[int] assert count(s) == 0 s.add 3 assert count(s) == 1 s.add 5 assert count(s) == 2
Source Edit proc find[T](s: SkipList[T]; r: var SkipList[T]; compare: SkipListFind[T]): bool
- Find a SkipList in s for which compare r yields Equal, storing the result in r; returns true if the value was found, else false. Source Edit
proc find[T](s: SkipList[T]; value: SkipList[T]; r: var SkipList[T]; compare: SkipListCmp[T] = `<>`): bool
- Find the SkipList value in SkipList s, storing the result in r; returns true if the value was found, else false. Source Edit
proc find[T](s: SkipList[T]; value: T): SkipList[T]
- Find the SkipList holding value in SkipList s; raises a KeyError` if the value was not found. Source Edit
proc find[T](s: SkipList[T]; value: T; r: var SkipList[T]): bool
- Find value in SkipList s, storing the result in r; returns true if the value was found, else false. Source Edit
proc newSkipList[T](value: T): SkipList[T]
- Instantiate a SkipList from value value. Source Edit
proc remove[T](s: var SkipList[T]; n: SkipList[T]): bool
-
Remove SkipList n from SkipList s; returns true if s changed.
Source Edits: The source SkipList n: The SkipList to remove proc remove[T](s: var SkipList[T]; value: T): bool {.discardable.}
- Remove value from SkipList s; returns true if s changed. Source Edit
proc toSkipList[T](values: openArray[T] = @[]): SkipList[T]
- Create a SkipList from an openArray values. Source Edit