Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created January 16, 2017 20:20
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/ba36610b7ae8edacb2941dfc3dc5ca95 to your computer and use it in GitHub Desktop.
Save deque-blog/ba36610b7ae8edacb2941dfc3dc5ca95 to your computer and use it in GitHub Desktop.
partial :: Env -> Expr -> Expr
partial env e@(Var v) =
case Map.lookup v env of
Nothing -> e
Just n -> cst n
partial env (Op opType xs) = Op opType (map (partial env) xs)
partial env e = e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment