Module type Container.Derived

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, 'acc) fold = 't -> init:'acc -> f:('acc -> 'a -> 'acc) -> 'acc
type ('t, 'a) iter = 't -> f:('a -> unit) -> unit
type 't length = 't -> int
val iter : fold:('t, 'a, unit) fold -> ('t, 'a) iter
val count : fold:('t, 'a, int) fold -> 't -> f:('a -> bool) -> int
val min_elt : fold:('t, 'a, 'a option) fold -> 't -> compare:('a -> 'a -> int) -> 'a option
val max_elt : fold:('t, 'a, 'a option) fold -> 't -> compare:('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 sum : fold:('t, 'a, 'sum) fold -> (module Summable with type t = 'sum) -> 't -> f:('a -> 'sum) -> 'sum
val fold_result : fold:('t, 'a, 'acc) fold -> init:'acc -> f:('acc -> 'a -> ('acc, 'e) Result.t) -> 't -> ('acc, 'e) Result.t
val fold_until : fold:('t, 'a, 'acc) fold -> init:'acc -> f:('acc -> 'a -> ('acc, 'final) Continue_or_stop.t) -> finish:('acc -> 'final) -> 't -> 'final

Generic definitions of container operations in terms of iter and length.

val is_empty : iter:('t, 'a) iter -> 't -> bool
val mem : iter:('t, 'a) iter -> 't -> 'a -> equal:('a -> 'a -> bool) -> bool
val exists : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> bool
val for_all : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> bool
val find : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> 'a option
val find_map : iter:('t, 'a) iter -> 't -> f:('a -> 'b option) -> 'b option
val to_array : length:'t length -> iter:('t, 'a) iter -> 't -> 'a array