Why Incremental?

Reactive computations made simple

Incremental offers a simple API that lets you write computations in a simple, all-at-once way, while getting the performance of a manually optimized, on-line algorithm.

Incremental can help you build:

  • Large spreadsheet-style calculations that react efficiently to changing data

  • Views in GUI applications that efficiently incorporate new data

  • Online versions of existing combinatorial algorithms

and much more. You can see how Incremental is applied to building JavaScript-based web UIs via our Incr_dom library and js_of_ocaml.

Extensive, well-documented API

Incremental’s powerful primitives are exposed in a rich, well-documented API.

Rigorously designed

Incremental is based on Umcut Acar et al.’s rigorous model of self-adjusting computations.

open! Core_kernel
module Incr = Incremental.Incremental.Make ()
module Incr_map = Incr_map.Make(Incr)

(** Given a map of entries with timestamps,
    incrementally compute a map containing
    only stale entries. *)
let stale_entries entries staleness_delay =
  let open Incr.Let_syntax in
  Incr_map.filter_mapi' entries
    ~f:(fun ~key:_ ~data ->
      let%bind (entry,time) = data in
      let when_stale =
        Time_ns.add time staleness_delay
      match%map Incr.at when_stale with
      | Before -> None
      | After  -> Some entry)

Getting Started


$ opam install incremental


open Core.Std
module Inc = Incremental_lib.Incremental.Make ()

API Documentation

See here for extensive API docs.

Related libraries

Learn more

“Seven Implementations of Incremental”

Yaron Minsky’s talk about the design process that led to Incremental.