Module Balanced_reducer
A Balanced_reducer.t stores a mutable fixed-length sequence of optional values, and incrementally maintains the result of folding an associative operation (reduce) over the sequence as its elements change.
val sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a t -> Ppx_sexp_conv_lib.Sexp.t
include Base.Invariant.S1 with type 'a t := 'a t
val invariant : 'a Base__.Invariant_intf.inv -> 'a t Base__.Invariant_intf.inv
val create_exn : ?sexp_of_a:('a -> Base.Sexp.t) -> Base.unit -> len:Base.int -> reduce:('a -> 'a -> 'a) -> 'a tcreate_exn ~len ~reducecreates a balanced reducer of lengthlen, all of whose elements areNone. It raises iflen < 1.
val set_exn : 'a t -> Base.int -> 'a -> Base.unitset_exn t i aupdates the value at indexitoSome a. It raises ifiis out of bounds.
val get_exn : 'a t -> Base.int -> 'aget_exn t igets the value at indexi. It raises ifiis out of bounds, orset_exn t ihas never been called.
val compute_exn : 'a t -> 'acompute_exn tcomputes the value of the fold. It raises if any values of the array areNone.