module Dllist: BatDllisttype 'a node_t
type'at ='a node_t
include BatInterfaces.Mappable
include BatEnum.Enumerable
exception Empty
val create : 'a -> 'a node_tval copy : 'a node_t -> 'a node_tval length : 'a node_t -> intval rev : 'a node_t -> unitto_list (rev (of_list [1;2;3;4])) = [1;4;3;2]val add : 'a node_t -> 'a -> unitadd n a Creates a new node containing data a and inserts it into
the list after node n. This is an O(1) operation.val append : 'a node_t -> 'a -> 'a node_tappend n a Creates a new node containing data a and inserts it into
the list after node n. Returns new node. This is an O(1) operation.val prepend : 'a node_t -> 'a -> 'a node_tprepend n a Creates a new node containing data a and inserts it into
the list before node n. Returns new node. This is an O(1) operation.val promote : 'a node_t -> unitpromote n Swaps n with next n. This is an O(1) operation.val demote : 'a node_t -> unitdemote n Swaps n with prev n. This is an O(1) operation.val remove : 'a node_t -> unitEmpty when trying to remove an element from a list of length one.val drop : 'a node_t -> 'a node_tEmpty when trying to remove an element from a list of length one.val rev_drop : 'a node_t -> 'a node_tEmpty when trying to remove an element from a list of length one.val splice : 'a node_t -> 'a node_t -> unitsplice n1 n2 Connects n1 and n2 so that
next n1 == n2 && prev n2 == n1. This can be used to connect two discrete
lists, or, if used on two nodes within the same list, it can be used to
separate the nodes between n1 and n2 from the rest of the list. In this
case, those nodes become a discrete list by themselves. This is an O(1)
operation.val get : 'a node_t -> 'aval set : 'a node_t -> 'a -> unitval next : 'a node_t -> 'a node_tThe list is circular, so the last node of the list returns the first node of the list as it's next node.
This is an O(1) operation.
val prev : 'a node_t -> 'a node_tThe list is circular, so the first node of the list returns the last element of the list as it's previous node.
This is an O(1) operation.
val skip : 'a node_t -> int -> 'a node_tskip n i Return the node that is i nodes after node n in the list.
If i is negative then return the node that is i nodes before node n
in the list. This is an O(N) operation.val iter : ('a -> unit) -> 'a node_t -> unititer f n Apply f to every element in the list, starting at n. This
is an O(N) operation.val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b node_t -> 'aval fold_right : ('a -> 'b -> 'b) -> 'a node_t -> 'b -> 'bval find : ('a -> bool) -> 'a node_t -> 'a node_tfind p l returns the first element, l or after, for which p
returns true.Not_found if no such element existsval for_all : ('a -> bool) -> 'a node_t -> boolval exists : ('a -> bool) -> 'a node_t -> boolval map : ('a -> 'b) -> 'a node_t -> 'b node_tval filter : ('a -> bool) -> 'a node_t -> 'a node_tfilter p l returns a new list, with entirely new nodes, whose
values are all the elements of the list l that satisfy the
predicate p. The order of the elements in the input list is
preserved.Empty if the resulting list is empty.val filter_map : ('a -> 'b option) -> 'a node_t -> 'b node_tfilter_map f l calls (f a0) (f a1) ... (f an) where a0,a1...an
are the elements of l. It returns a new list of elements bi
such as f ai = Some bi (when f returns None, the
corresponding element of l is discarded).Empty if the resulting list is empty.val to_list : 'a node_t -> 'a listval of_list : 'a list -> 'a node_tEmpty if given list is empty. This is an O(N) operation.val enum : 'a node_t -> 'a BatEnum.tval rev_enum : 'a node_t -> 'a BatEnum.trev_enum (of_list [1;2;3;4]) will generate the enumeration [1;4;3;2].
If you want it to start with the last one, see backwards.
Note that modifying the list while the enum exists will have undefined
effects. This is an O(1) operation.
val backwards : 'a node_t -> 'a BatEnum.tbackwards t is similar to rev_enum t except that the enumeration
starts at the node before the current one:
backwards (of_list [1;2;3;4]) will generate the enumeration [4;3;2;1].
val of_enum : 'a BatEnum.t -> 'a node_tEmpty if given enum is empty. This is an O(N) operation.val print : ?first:string ->
?last:string ->
?sep:string ->
('a BatInnerIO.output -> 'b -> unit) ->
'a BatInnerIO.output -> 'b t -> unit