Base.Indexed_container
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.
module 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))
.
Generic definitions of indexed container operations in terms of foldi
.
Generic definitions of indexed container operations in terms of iteri
.