NS.List
include module type of ContainersLabels.List
val combine_gen : 'a list -> 'b list -> ('a * 'b) gen
module Ref : sig ... end
module type MONAD = sig ... end
val random : 'a random_gen -> 'a list random_gen
val random_non_empty : 'a random_gen -> 'a list random_gen
val random_len : int -> 'a random_gen -> 'a list random_gen
val random_choose : 'a list -> 'a random_gen
val random_sequence : 'a random_gen list -> 'a list random_gen
val to_iter : 'a list -> 'a iter
val of_iter : 'a iter -> 'a list
val to_gen : 'a list -> 'a gen
val of_gen : 'a gen -> 'a list
module Infix : sig ... end
include Ppx_compare_lib.Comparable.S1 with type 'a t := 'a t
val compare :
'a Base__Ppx_compare_lib.compare ->
'a t Base__Ppx_compare_lib.compare
include Ppx_compare_lib.Equal.S1 with type 'a t := 'a t
val equal : 'a Base__Ppx_compare_lib.equal -> 'a t Base__Ppx_compare_lib.equal
val pp :
?pre:(unit, Stdlib.Format.formatter, unit, unit) Stdlib.format4 ->
?suf:(unit, Stdlib.Format.formatter, unit, unit) Stdlib.format4 ->
(unit, Stdlib.Format.formatter, unit, unit) Stdlib.format4 ->
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
'a list ->
unit
Pretty-print a list.
val pp_diff :
cmp:('a -> 'a -> int) ->
?pre:(unit, Stdlib.Format.formatter, unit, unit) Stdlib.format4 ->
?suf:(unit, Stdlib.Format.formatter, unit, unit) Stdlib.format4 ->
(unit, Stdlib.Format.formatter, unit, unit) Stdlib.format4 ->
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
('a list * 'a list) ->
unit
val hd : 'a t -> 'a option
val hd_exn : 'a t -> 'a
val mem : 'a -> 'a t -> eq:('a -> 'a -> bool) -> bool
val iter : 'a t -> f:('a -> unit) -> unit
val exists : 'a t -> f:('a -> bool) -> bool
val for_all : 'a t -> f:('a -> bool) -> bool
val find : 'a t -> f:('a -> bool) -> 'a option
val find_exn : 'a t -> f:('a -> bool) -> 'a
val find_map : 'a t -> f:('a -> 'b option) -> 'b option
val find_map_exn : 'a t -> f:('a -> 'b option) -> 'b
Returns the input list without the first element eq
ual to the argument, or raise Not_found
if no such element exists.
partition xs ~f
returns a pair of lists (ts, fs)
, where ts
is the list of all the elements of xs
that satisfy the predicate f
, and fs
is the list of all the elements of xs
that do not satisfy f
. The order of the elements in the input list is preserved.
partition_map xs ~f
returns a pair of lists (ls, rs)
such that, for each element x
of the input list xs
:
f x
is Left l
, then l
is in ls
, andf x
is Right r
, then r
is in rs
.The output elements are included in ls
and rs
in the same relative order as the corresponding input elements in xs
.
rev_partition_map xs ~f
is (rev ls, rev rs)
where partition_map xs ~f = (ls, rs)
. This avoids the rev
that partition_map
performs.
partition_map_endo xs ~f
is equivalent to partition_map xs ~f
but specialized to the case where the left and input elements have the same type. Preserves ==
if f x
is Left x
for all x
in xs
.
fold_partition_map
is like partition_map
but threads an accumulator through the calls to f
.
val fold_partition_map_endo :
'a t ->
's ->
f:('a -> 's -> ('a, 'r) Either.t * 's) ->
'a t * 'r t * 's
fold_partition_map_endo xs s ~f
is equivalent to fold_partition_map xs s ~f
but specialized to the case where the left and input elements have the same type. Preserves ==
if f x
is Left x
for all x
in xs
.
Like map
, but specialized to require f
to be an endofunction, which enables preserving ==
if f
preserves ==
of every element.
val rev_map_split : 'a t -> f:('a -> 'b * 'c) -> 'b list * 'c list
rev_map_split ~f xs
is split (rev_map ~f xs)
but more efficient.
val foldi : 'a t -> 's -> f:(int -> 'a -> 's -> 's) -> 's
val reduce : 'a t -> f:('a -> 'a -> 'a) -> 'a option
module Assoc : sig ... end
val mem_assoc : 'a -> ('a * _) t -> eq:('a -> 'a -> bool) -> bool