package incremental_kernel

  1. Overview
  2. Docs

A module internal to Incremental. Users should see Incremental_intf.

A Balanced_reducer.t is a mutable non-empty array that tracks the result of folding an associative operation (reduce) over the array as its elements change.

type 'a t
val sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a t -> Ppx_sexp_conv_lib.Sexp.t
include Core_kernel.Invariant.S1 with type 'a t := 'a t
val invariant : ('a -> unit) -> 'a t -> unit
val create_exn : ?sexp_of_a:('a -> Core_kernel.Sexp.t) -> unit -> len:int -> reduce:('a -> 'a -> 'a) -> 'a t

create_exn ~len ~reduce creates an array containing len Nones and prepares an incremental fold with reduce. It raises if len < 1.

val set_exn : 'a t -> int -> 'a -> unit

set_exn t i a updates the value at index i to Some a. It raises if i is out of bounds.

val compute_exn : 'a t -> 'a

compute_exn t computes the value of the fold. It raises if any values of the array are None.

OCaml

Innovation. Community. Security.