package base

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Elt : sig ... end
type t
val fold : t -> init:'acc -> f:('acc -> Elt.t -> 'acc) -> 'acc
val iter : [ `Define_using_fold | `Custom of t -> f:(Elt.t -> unit) -> unit ]

The iter argument to Container.Make specifies how to implement the container's iter function. `Define_using_fold means to define iter via:

iter t ~f = Container.iter ~fold t ~f

`Custom overrides the default implementation, presumably with something more efficient. Several other functions returned by Container.Make are defined in terms of iter, so passing in a more efficient iter will improve their efficiency as well.

val length : [ `Define_using_fold | `Custom of t -> int ]

The length argument to Container.Make specifies how to implement the container's length function. `Define_using_fold means to define length via:

length t ~f = Container.length ~fold t ~f

`Custom overrides the default implementation, presumably with something more efficient. Several other functions returned by Container.Make are defined in terms of length, so passing in a more efficient length will improve their efficiency as well.

val iteri : [ `Define_using_fold | `Custom of t -> f:(int -> Elt.t -> unit) -> unit ]
val foldi : [ `Define_using_fold | `Custom of t -> init:_ -> f:(int -> _ -> Elt.t -> _) -> _ ]
OCaml

Innovation. Community. Security.