Skip to content
A library for incremental computations. Based on janestreet/incremental (https://github.com/janestreet/incremental) for OCaml.
F#
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Tests Add randomly generated graph test Sep 6, 2018
.gitignore First draft of Incremental.NET Aug 28, 2018
Core.fs First draft of Incremental.NET Aug 28, 2018
Incremental.NET.fsproj First draft of Incremental.NET Aug 28, 2018
Incremental.NET.sln First draft of Incremental.NET Aug 28, 2018
LICENSE Initial commit Aug 28, 2018
README.md First draft of Incremental.NET Aug 28, 2018

README.md

Incremental.NET

A library for incremental computations.

Based on janestreet/incremental for OCaml. Also inspired by Gjallarhorn.

Usage -- see tests

use Incr = new Incremental()
let Var = Incr.Var

let myOrders = Var.Create([100; 150; 200])
use maxOrder = Incremental.map Incr myOrders List.max
use minOrder = Incremental.map Incr myOrders List.min
use orderRange = Incremental.map2 Incr maxOrder minOrder (-)

let log = ResizeArray<string>()
use maxChanged = maxOrder.Subscribe (fun maxOrder -> log.Add(sprintf "Max changed to %d" maxOrder))

let worldVersion = Incr.Stabilize()

Assert.AreEqual([100; 150; 200], myOrders.Value)
Assert.AreEqual(200, maxOrder.Value)
Assert.AreEqual(100, minOrder.Value)
Assert.AreEqual(100, orderRange.Value)

myOrders.SetValue([300;400;500])
Incr.Stabilize() |> ignore

Assert.AreEqual(500, maxOrder.Value)

Assert.AreEqual("Max changed to 500", Seq.last(log))

Differences from Gjallarhorn:

  • Thread safety (easy for user to make sure they get a consistent view)
  • Control when computations happen (user must call .Stabilize())
  • Fewer features, less code

Roadmap

See also

You can’t perform that action at this time.