Skip to content

Instantly share code, notes, and snippets.

@abp
Created February 8, 2013 01:56
Show Gist options
  • Save abp/4736021 to your computer and use it in GitHub Desktop.
Save abp/4736021 to your computer and use it in GitHub Desktop.
(def g
{:a 1
:d/b 2
:b/a (fnk [a] (* a 7))
:x (fnk [b/a [d/b 2] [c 3]] (+ b/a d/b c))})
(def cg (compile-graph g))
(iterate cg)
; => {:x 12, :b/a 7, :d/b 2, :a 1}
(iterate cg {:a 7 :x 15} :a)
; => {:d/b 2, :b/a 49, :x 54, :a 7}
(iterate cg {:b/a 11 :a 7 :x 15} :x)
; => {:d/b 2, :x 15, :a 7, :b/a 11}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment