module List:sig..end
val init : int -> (int -> 'a) -> 'a listArray.init, init n f returns the list containing
the results of (f 0),(f 1).... (f (n-1)).
Raise Invalid_arg "ExtList.init" if n < 0.val first : 'a list -> 'aEmpty_list if
the list is empty (similar to hd).val last : 'a list -> 'aEmpty_list if
the list is empty. This function takes linear time.val iteri : (int -> 'a -> 'b) -> 'a list -> unititeri f l will call (f 0 a0);(f 1 a1) ... (f n an) where
a0..an are the elements of the list l.val mapi : (int -> 'a -> 'b) -> 'a list -> 'b listmapi f l will build the list containing
(f 0 a0);(f 1 a1) ... (f n an) where a0..an are the elements of
the list l.val rfind : ('a -> bool) -> 'a list -> 'arfind p l returns the last element x of l such as p x returns
true or raises Not_found if such element as not been found.val find_exc : ('a -> bool) -> exn -> 'a list -> 'afind_exc p e l returns the first element of l such as p x
returns true or raises e if such element as not been found.val unique : ?cmp:('a -> 'a -> bool) -> 'a list -> 'a listunique cmp l returns the list l without any duplicate element.
Default comparator ( = ) is used if no comparison function specified.val filter_map : ('a -> 'b option) -> 'a list -> 'b listfilter_map f l call (f a0) (f a1).... (f an) where a0..an are
the elements of l. It returns the list of elements bi such as
f ai = Some bi (when f returns None, the corresponding element of
l is discarded).val split_nth : int -> 'a list -> 'a list * 'a listsplit_nth n l returns two lists l1 and l2, l1 containing the
first n elements of l and l2 the others. Raise Invalid_index if
n is outside of l size bounds.val remove : 'a list -> 'a -> 'a listremove l x returns the list l without the first element x found
or returns l if no element is equal to x. Elements are compared
using ( = ).val remove_if : ('a -> bool) -> 'a list -> 'a listremove_if cmp l x is similar to remove, but with cmp used
instead of ( = ).val remove_all : 'a list -> 'a -> 'a listremove_all l x is similar to remove but removes all elements that
are equal to x and not only the first one.val take : int -> 'a list -> 'a listtake n l returns up to the n first elements from list l, if
available.val drop : int -> 'a list -> 'a listdrop n l returns l without the first n elements, or the empty
list if l have less than n elements.val enum : 'a list -> 'a Enum.tval of_enum : 'a Enum.t -> 'a listval hd : 'a list -> 'aEmpty_list if the
list is empty.val tl : 'a list -> 'a listEmpty_list if
the list is empty.val nth : 'a list -> int -> 'anth l n returns the n-th element of the list l or raise
Invalid_index is the index is outside of l bounds.val sort : ?cmp:('a -> 'a -> int) -> 'a list -> 'a listcompare).Invalid_arg but Different_list_size when used on two
lists having a different number of elements.val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c listval iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unitval fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'aval fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'cval for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> boolval exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> boolval combine : 'a list -> 'b list -> ('a * 'b) listList
module ones but are tail-recursive. That means they will not
cause a Stack_overflow when used on very long list.
The implementation might be a little more slow in bytecode,
but compiling in native code will not affect performances.
val map : ('a -> 'b) -> 'a list -> 'b listval append : 'a list -> 'a list -> 'a listval flatten : 'a list list -> 'a listval concat : 'a list list -> 'a listval fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'bval remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) listval remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) listval split : ('a * 'b) list -> 'a list * 'b listList
module but were using List.rev calls. The new implementations
have better performances.val filter : ('a -> bool) -> 'a list -> 'a listval find_all : ('a -> bool) -> 'a list -> 'a listval partition : ('a -> bool) -> 'a list -> 'a list * 'a listval length : 'a list -> intval rev_append : 'a list -> 'a list -> 'a listval rev : 'a list -> 'a listval rev_map : ('a -> 'b) -> 'a list -> 'b listval iter : ('a -> unit) -> 'a list -> unitval fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'aval for_all : ('a -> bool) -> 'a list -> boolval exists : ('a -> bool) -> 'a list -> boolval find : ('a -> bool) -> 'a list -> 'aval mem : 'a -> 'a list -> boolval memq : 'a -> 'a list -> boolval assoc : 'a -> ('a * 'b) list -> 'bval assq : 'a -> ('a * 'b) list -> 'bval mem_assoc : 'a -> ('a * 'b) list -> boolval mem_assq : 'a -> ('a * 'b) list -> boolval stable_sort : ('a -> 'a -> int) -> 'a list -> 'a listval fast_sort : ('a -> 'a -> int) -> 'a list -> 'a listval merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a listexception Empty_list
Empty_list is raised when an operation applied on an empty list
is invalid : hd for example.exception Invalid_index of int
Invalid_index is raised when an indexed access on a list is
out of list bounds.exception Different_list_size of string
Different_list_size is raised when applying functions such as
iter2 on two lists having different size.