skiplist (erlang_skiplist v0.3.0) View Source

API for interacting with a skiplist

Link to this section Summary

Functions

Get the value from the back of the skiplist. Does not mutate the skiplist.
Empties the skiplist.
Checks whether the skiplist contains the given Value.
Removes consecutive duplicates items from the skiplist. Mutates the skiplist.
Get the value from the front of the skiplist. Does not mutate the skiplist.
Insert Value at the Index of the skiplist.
Returns true if the skiplist is empty, false otherwise.
Return length of the skiplist.
Modify the skiplist and insert Value at the given Index.
Create a new empty skiplist.
Get the value at the nth index of the skiplist. Does not mutate the skiplist.
Pop from back of the skiplist. Mutates the existing skiplist.
Pop from front of the skiplist. Mutates the existing skiplist.
Push Value to the back of the skiplist.
Push Value to the front of the skiplist.
Remove the value at the specified index of the skiplist. Mutates the skiplist.
Converst the skiplist reference to erlang style list.
Create a new skiplist with specific Capacity.

Link to this section Functions

Specs

back(Skiplist :: reference()) -> {ok, integer()} | {error, any()}.
Get the value from the back of the skiplist. Does not mutate the skiplist.

Specs

clear(Skiplist :: reference()) -> ok | {error, any()}.
Empties the skiplist.
Link to this function

contains(Skiplist, Value)

View Source

Specs

contains(Skiplist :: reference(), Value :: integer()) -> boolean().
Checks whether the skiplist contains the given Value.

Specs

dedup(Skiplist :: reference()) -> ok.
Removes consecutive duplicates items from the skiplist. Mutates the skiplist.

Specs

front(Skiplist :: reference()) -> {ok, integer()} | {error, any()}.
Get the value from the front of the skiplist. Does not mutate the skiplist.
Link to this function

insert(Skiplist, Value, Index)

View Source

Specs

insert(Skiplist :: reference(), Value :: integer(), Index :: non_neg_integer()) ->
          ok | {error, any()}.
Insert Value at the Index of the skiplist.

Specs

is_empty(Skiplist :: reference()) -> boolean().
Returns true if the skiplist is empty, false otherwise.

Specs

len(Skiplist :: reference()) -> non_neg_integer().
Return length of the skiplist.
Link to this function

modify(Skiplist, Value, Index)

View Source

Specs

modify(Skiplist :: reference(), Value :: integer(), Index :: non_neg_integer()) ->
          ok | {error, any()}.
Modify the skiplist and insert Value at the given Index.

Specs

new() -> {ok, reference()} | {error, any()}.
Create a new empty skiplist.

Specs

nth(Skiplist :: reference(), Index :: non_neg_integer()) -> {ok, integer()} | {error, any()}.
Get the value at the nth index of the skiplist. Does not mutate the skiplist.

Specs

pop_back(Skiplist :: reference()) -> {ok, integer()} | {error, any()}.
Pop from back of the skiplist. Mutates the existing skiplist.

Specs

pop_front(Skiplist :: reference()) -> {ok, integer()} | {error, any()}.
Pop from front of the skiplist. Mutates the existing skiplist.
Link to this function

push_back(Skiplist, Value)

View Source

Specs

push_back(Skiplist :: reference(), Value :: integer()) -> ok | {error, any()}.
Push Value to the back of the skiplist.
Link to this function

push_front(Skiplist, Value)

View Source

Specs

push_front(Skiplist :: reference(), Value :: integer()) -> ok | {error, any()}.
Push Value to the front of the skiplist.

Specs

remove(Skiplist :: reference(), Index :: non_neg_integer()) -> {ok, integer()} | {error, any()}.
Remove the value at the specified index of the skiplist. Mutates the skiplist.

Specs

to_list(Skiplist :: reference()) -> [integer()].
Converst the skiplist reference to erlang style list.

Specs

with_capacity(Capacity :: pos_integer()) -> {ok, reference()} | {error, any()}.
Create a new skiplist with specific Capacity.