Slink

Undocumented in source.

Members

Aliases

Comparator
alias Comparator = Compare!(V)
Undocumented in source.
Ref
alias Ref = Type*
Undocumented in source.
Type
alias Type = Slink!(V, K, Identity, HashCache)
Undocumented in source.

Functions

attach
void attach(Ref p)

Splice in p between current cell and whatever it was previously pointing to

copy
Ref copy(Ref delegate() alloc)

Make a copy of the list; i.e., a new list containing new cells but including the same elements in the same order

count
int count(V element)

Count the number of occurrences of element in list

count
int count()

Return the number of cells in the list

countKey
int countKey(K key)

add support for keys also?

countPair
int countPair(K key, V value)

add support for keys also?

detachNext
void detachNext()

Cause current cell to skip over the current next() one, effectively removing the next element from the list

dup
Ref dup(Ref delegate() alloc)

dup is shallow; i.e., just makes a copy of the current cell

find
Ref find(V element)

Linear search down the list looking for element

findKey
Ref findKey(K key)

add support for keys also?

findPair
Ref findPair(K key, V value)

add support for keys also?

hash
hash_t hash()

add support for keys also?

index
int index(V element)

Return the number of cells traversed to find first occurrence of a cell with element() element, or -1 if not present

indexKey
int indexKey(K key)

add support for keys also?

indexPair
int indexPair(K key, V value)

add support for keys also?

nth
Ref nth(int n)

Return the nth cell of the list, or null if no such

set
Ref set(K k, V v, Ref n)

add support for keys also?

set
Ref set(V v, Ref n)

Set to point to n as next cell

tail
Ref tail()

Return the cell representing the last element of the list (i.e., the one whose next() is null

Static functions

merge
Ref merge(Ref fst, Ref snd, Comparator cmp)

Basic linkedlist merge algorithm. Merges the lists head by fst and snd with respect to cmp

sort
Ref sort(Ref s, Comparator cmp)

Standard merge sort algorithm

split
Ref split(Ref s)

Standard list splitter, used by sort. Splits the list in half. Returns the head of the second half

Variables

cache
hash_t cache;
Undocumented in source.
key
K key;

add support for keys also?

next
Ref next;
Undocumented in source.
value
V value;
Undocumented in source.

Meta