Skip to content

Instantly share code, notes, and snippets.

@khooyp
khooyp / incremental_eval_order_test.ml
Last active January 27, 2020 03:57
Example of Incremental's height-based evaluation order leading to change propagation inconsistent with from-scratch evaluation, compared to Classic Adapton
module Inc = Incremental_lib.Incremental.Make ()
open Inc
let make init =
let num = 4 in
let den_v = Var.create init in
let den = Var.watch den_v in
(* computes "if den = 0 then 0 else num / den" *)
let div = bind den (fun den -> return (num / den)) in