package spotlib
Module Spotlib.Dllist
val create : unit -> 'a tCreate an empty dllist
val length : 'a t -> intO(1). The length of the dllist
val is_empty : 'a t -> boollist node returns Some t if node is an element of t. If node is removed, it returns None.
val is_removed : 'a node -> boolval value : 'a node -> 'aGet the value from the node
O(1). add t v adds v to dllist t and returns the newly created node for v. The node is used to remove the value from t in constant time.
O(1). remove node removes node from the dllist it belongs to. Successful removal returns `Ok. If the node is already removed, remove node returns `Already_removed.
tl t returns the second node of the dllist t.
None : t is null Some None : t is a singleton Some (Some n) : n is the second
Iteration over the nodes of a dllist from the top to the bottom
Folding the nodes of a dllist from the top to the bottom
Folding the nodes of a dllist from the bottom to top
fold_left with stop
scan but starts with a node
val to_list : 'a t -> 'a listval of_list : 'a list -> 'a tval invariant : 'a t -> unitInvariant checks