ocaml-base-compiler

Official release 4.07.1
IN THIS PACKAGE
Module Misc . Stdlib . List
type 'a t = 'a list
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int

The lexicographic order supported by the provided order. There is no constraint on the relative lengths of the lists.

val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool

Returns true iff the given lists have the same length and content with respect to the given equality function.

val filter_map : ( 'a -> 'b option ) -> 'a t -> 'b t

filter_map f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

val some_if_all_elements_are_some : 'a option t -> 'a t option

If all elements of the given list are Some _ then Some xs is returned with the xs being the contents of those Somes, with order preserved. Otherwise return None.

val map2_prefix : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t * 'b t

let r1, r2 = map2_prefix f l1 l2 If l1 is of length n and l2 = h2 @ t2 with h2 of length n, r1 is List.map2 f l1 h1 and r2 is t2.

val split_at : int -> 'a t -> 'a t * 'a t

split_at n l returns the pair before, after where before is the n first elements of l and after the remaining ones. If l has less than n elements, raises Invalid_argument.