Created
January 20, 2017 21:31
-
-
Save deque-blog/f80af44d8603e1c59930935946b0f37a to your computer and use it in GitHub Desktop.
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
partial :: Env -> Expr -> Expr | |
partial env = cata (compAll [optimizeMul, optimizeAdd, replaceKnownVars env]) | |
eval :: Env -> Expr -> Int | |
eval env expr = | |
case partial env expr of | |
(Fix (Cst n)) -> n | |
e -> error $ "Missing vars: " ++ show (dependencies e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment