package base

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Base.Indexed_containerSource

Provides generic signatures for containers that support indexed iteration (iteri, foldi, ...). In principle, any container that has iter can also implement iteri, but the idea is that Indexed_container_intf should be included only for containers that have a meaningful underlying ordering.

Sourcemodule type Generic = sig ... end
Sourcemodule type S0 = sig ... end
Sourcemodule type S1 = sig ... end

Generic definitions of foldi and iteri in terms of fold.

E.g., iteri ~fold t ~f = ignore (fold t ~init:0 ~f:(fun i x -> f i x; i + 1)).

Sourceval foldi : fold:('t -> init:'accum -> f:('accum -> 'a -> 'accum) -> 'accum) -> 't -> init:'accum -> f:(int -> 'accum -> 'a -> 'accum) -> 'accum
Sourceval iteri : fold:('t -> init:int -> f:(int -> 'a -> int) -> int) -> 't -> f:(int -> 'a -> unit) -> unit

Generic definitions of indexed container operations in terms of foldi.

Sourceval counti : foldi:('t -> init:int -> f:(int -> int -> 'a -> int) -> int) -> 't -> f:(int -> 'a -> bool) -> int

Generic definitions of indexed container operations in terms of iteri.

Sourceval existsi : iteri:('t -> f:(int -> 'a -> unit) -> unit) -> 't -> f:(int -> 'a -> bool) -> bool
Sourceval for_alli : iteri:('t -> f:(int -> 'a -> unit) -> unit) -> 't -> f:(int -> 'a -> bool) -> bool
Sourceval findi : iteri:('t -> f:(int -> 'a -> unit) -> unit) -> 't -> f:(int -> 'a -> bool) -> (int * 'a) option
Sourceval find_mapi : iteri:('t -> f:(int -> 'a -> unit) -> unit) -> 't -> f:(int -> 'a -> 'b option) -> 'b option
Sourcemodule Make (T : sig ... end) : S1 with type 'a t := 'a T.t
Sourcemodule Make0 (T : sig ... end) : S0 with type t := T.t and type elt := T.Elt.t
Sourcemodule Make_gen (T : sig ... end) : Generic with type 'a t := 'a T.t and type 'a elt := 'a T.elt
OCaml

Innovation. Community. Security.