module BatRefList:sig..end
RefList is a extended set of functions that manipulate list
references.
Author(s): Nicolas Cannasse, David Teller (Boilerplate code)
exception Empty_list
type 'a t
val empty : unit -> 'a tval is_empty : 'a t -> booltrue if a ref list is emptyval clear : 'a t -> unitval length : 'a t -> intval copy : dst:'a t -> src:'a t -> unitval copy_list : dst:'a t -> src:'a list -> unitval copy_enum : dst:'a t -> src:'a BatEnum.t -> unitdst : A reflist, whose contents will be forgotten.val of_list : 'a list -> 'a tval to_list : 'a t -> 'a listval of_enum : 'a BatEnum.t -> 'a tval enum : 'a t -> 'a BatEnum.tval of_backwards : 'a BatEnum.t -> 'a tval backwards : 'a t -> 'a BatEnum.tval add : 'a t -> 'a -> unitval push : 'a t -> 'a -> unitval add_sort : cmp:('a -> 'a -> int) -> 'a t -> 'a -> unitval first : 'a t -> 'aEmpty_list if the ref list is emptyval last : 'a t -> 'aEmpty_list if the ref list is emptyval pop : 'a t -> 'aEmpty_list if the ref list is emptyval npop : 'a t -> int -> 'a listEmpty_list if the ref list does not
contain enough elementsval hd : 'a t -> 'afirstval tl : 'a t -> 'a tEmpty_list if the ref list is emptyval rev : 'a t -> unitval fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'aList.fold_left f a (ref [b0; b1; ...; bn]) is
f (... (f (f a b0) b1) ...) bn.val fold_right : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'bList.fold_right f (ref [a0; a1; ...; an]) b is
f a0 (f a1 (... (f an b) ...)). Tail-recursive.val iter : ('a -> unit) -> 'a t -> unitval find : ('a -> bool) -> 'a t -> 'aNot_found if no element is foundval rfind : ('a -> bool) -> 'a t -> 'aNot_found if no element is foundval find_exc : ('a -> bool) -> exn -> 'a t -> 'aval exists : ('a -> bool) -> 'a t -> booltrue if an element matches the specified
predicateval for_all : ('a -> bool) -> 'a t -> booltrue if all elements match the specified
predicateval map : ('a -> 'b) -> 'a t -> 'b tval transform : ('a -> 'a) -> 'a t -> unitval map_list : ('a -> 'b) -> 'a t -> 'b listval sort : cmp:('a -> 'a -> int) -> 'a t -> unitval filter : ('a -> bool) -> 'a t -> unitval remove : 'a t -> 'a -> unitNot_found if the element is not foundval remove_if : ('a -> bool) -> 'a t -> unitNot_found if no element has been removedval remove_all : 'a t -> 'a -> unitmodule Index:sig..end
i in a list (with
indices starting from 0).