Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created January 17, 2017 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/de45132c1e92596ef394e3875d3f30c5 to your computer and use it in GitHub Desktop.
Save deque-blog/de45132c1e92596ef394e3875d3f30c5 to your computer and use it in GitHub Desktop.
> let e = add [ cst(1)
, cst(2)
, mul [cst(0), var("x"), var("y")]
, mul [cst(1), var("y"), cst(2)]
, add [cst(0), var("x") ]]
> let env = Map.fromList [("x", 1), ("y", 2)]
> prn e
"(+ 1 2 (* 0 x y) (* 1 y 2) (+ 0 x))"
> eval env e
8
-- (+ 1 2 (* 0 1 2) (* 1 2 2) (+ 0 1))
-- (+ 3 4 1)
-- 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment