Created
October 1, 2012 02:43
-
-
Save w01fe/3809193 to your computer and use it in GitHub Desktop.
Simple graph compilation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Functionally identical to (defn stats ...) above | |
(def stats (graph/eager-compile stats-graph)) | |
(stats {:xs [1 2 3 6]}) | |
; ==> {:n 4 | |
; :m 3 | |
; :m2 12.5 | |
; :v 3.5) | |
;; Result is error checked | |
(stats {:ys [1 2 3 6]}) | |
; ==> (Exception. "Missing argument :xs ...") | |
;; Compilation is error checked too. | |
(graph/eager-compile | |
{:x (fnk [y] (inc y)) | |
:y (fnk [x] (dec x))}) | |
; ==> (Exception. "Cannot compile cyclic graph | |
(:x --> :y --> :x)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment