Module Base.Container

module type S0 = Container_intf.S0
module type S1 = Container_intf.S1

Generic definitions of container operations in terms of fold.

E.g.: iter ~fold t ~f = fold t ~init:() ~f:(fun () a -> f a).

type ('t, 'a, 'accum) fold = 't ‑> init:'accum ‑> f:('accum ‑> 'a ‑> 'accum) ‑> 'accum
type ('t, 'a) iter = 't ‑> f:('a ‑> unit) ‑> unit
val iter : fold:('t'a, unit) fold ‑> ('t'aiter
val count : fold:('t'a, int) fold ‑> 't ‑> f:('a ‑> bool) ‑> int
val min_elt : fold:('t'a'a option) fold ‑> 't ‑> cmp:('a ‑> 'a ‑> int) ‑> 'a option
val max_elt : fold:('t'a'a option) fold ‑> 't ‑> cmp:('a ‑> 'a ‑> int) ‑> 'a option
val length : fold:('t_, int) fold ‑> 't ‑> int
val to_list : fold:('t'a'a list) fold ‑> 't ‑> 'a list
val to_array : fold:('t'a'a list) fold ‑> 't ‑> 'a array
val sum : fold:('t'a'sumfold ‑> (module Commutative_group.S with type t = 'sum) ‑> 't ‑> f:('a ‑> 'sum) ‑> 'sum
val fold_result : fold:('t'a'bfold ‑> init:'b ‑> f:('b ‑> 'a ‑> ('b'eResult.t) ‑> 't ‑> ('b'eResult.t
val fold_until : fold:('t'a'bfold ‑> init:'b ‑> f:('b ‑> 'a ‑> ('b'stopContainer_intf.Continue_or_stop.t) ‑> 't ‑> ('b'stopContainer_intf.Finished_or_stopped_early.t
val is_empty : iter:('t'aiter ‑> 't ‑> bool

Generic definitions of container operations in terms of iter.

val exists : iter:('t'aiter ‑> 't ‑> f:('a ‑> bool) ‑> bool
val for_all : iter:('t'aiter ‑> 't ‑> f:('a ‑> bool) ‑> bool
val find : iter:('t'aiter ‑> 't ‑> f:('a ‑> bool) ‑> 'a option
val find_map : iter:('t'aiter ‑> 't ‑> f:('a ‑> 'b option) ‑> 'b option
module Make : functor (T : Container_intf.Make_arg) -> S1 with type t := a T.t

The idiom for using Container.Make is to bind the resulting module and to explicitly import each of the functions that one wants:

module Make0 : functor (T : Container_intf.Make0_arg) -> S0 with type t := T.t and type elt := T.Elt.t