module BatRefList:Reference on lists.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 t
val is_empty : 'a t -> bool
true
if a ref list is emptyval clear : 'a t -> unit
val length : 'a t -> int
val copy : dst:'a t -> src:'a t -> unit
val copy_list : dst:'a t -> src:'a list -> unit
val copy_enum : dst:'a t -> src:'a BatEnum.t -> unit
dst
: A reflist, whose contents will be forgotten.val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_enum : 'a BatEnum.t -> 'a t
val enum : 'a t -> 'a BatEnum.t
val of_backwards : 'a BatEnum.t -> 'a t
val backwards : 'a t -> 'a BatEnum.t
val add : 'a t -> 'a -> unit
val push : 'a t -> 'a -> unit
val add_sort : ?cmp:('a -> 'a -> int) -> 'a t -> 'a -> unit
val first : 'a t -> 'a
Empty_list
if the ref list is emptyval last : 'a t -> 'a
val pop : 'a t -> 'a
Empty_list
if the ref list is emptyval npop : 'a t -> int -> 'a list
Empty_list
if the ref list does not
contain enough elementsval hd : 'a t -> 'a
first
val tl : 'a t -> 'a t
Empty_list
if the ref list is emptyval rev : 'a t -> unit
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
List.fold_left f a [b1; ...; bn]
is
f (... (f (f a b1) b2) ...) bn
.val fold_right : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b
List.fold_right f [a1; ...; an] b
is
f a1 (f a2 (... (f an b) ...))
. Tail-recursive.val iter : ('a -> unit) -> 'a t -> unit
val find : ('a -> bool) -> 'a t -> 'a
Not_found
if no element is foundval rfind : ('a -> bool) -> 'a t -> 'a
Not_found
if no element is foundval find_exc : ('a -> bool) -> exn -> 'a t -> 'a
val exists : ('a -> bool) -> 'a t -> bool
true
if an element matches the specified
predicateval for_all : ('a -> bool) -> 'a t -> bool
true
if all elements match the specified
predicateval map : ('a -> 'b) -> 'a t -> 'b t
val transform : ('a -> 'a) -> 'a t -> unit
val map_list : ('a -> 'b) -> 'a t -> 'b list
val sort : ?cmp:('a -> 'a -> int) -> 'a t -> unit
val filter : ('a -> bool) -> 'a t -> unit
val remove : 'a t -> 'a -> unit
Not_found
if the element is not foundval remove_if : ('a -> bool) -> 'a t -> unit
Not_found
if no element has been removedval remove_all : 'a t -> 'a -> unit
module Index:sig
..end
i
th element of a list.