-
-
Save SAdams601/bae16e3d91e995ea0266 to your computer and use it in GitHub Desktop.
The patterns in eval that need to modify the state
This file contains 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
eval :: Expr -> EvalSt Int | |
eval (Var v) = do | |
env <- get | |
return (head [val | (x,val) <- env, x==v]) | |
eval (Assign x e) = do | |
v <- eval e | |
env <- get | |
put $ (x,v):env | |
return v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment