diff --git a/src/Evaluator.hs b/src/Evaluator.hs index 668cbe6..22a31a1 100644 --- a/src/Evaluator.hs +++ b/src/Evaluator.hs @@ -15,8 +15,9 @@ base = M.fromList [ eval :: Env -> Expr -> (Env, Expr) eval env (IntE x) = (env, IntE x) -eval env (VarE v) = eval env $ env M.! v -eval env (SetE v expr) = (M.insert v expr env, expr) +eval env (VarE v) = (M.insert v nExpr nEnv, nExpr) + where (nEnv, nExpr) = eval env $ env M.! v +eval env (SetE v expr) = (M.insert v expr env, NilE) eval env NilE = (env, NilE) --apply :: Proc -> Args -> Expr diff --git a/src/ExprType.hs b/src/ExprType.hs index 97635b5..704c06d 100644 --- a/src/ExprType.hs +++ b/src/ExprType.hs @@ -4,9 +4,9 @@ data Expr = IntE Integer | VarE String | ProcedureE String [Expr] | SetE String Expr - | NilE + | NilE deriving (Show) -instance Show Expr where - show (IntE x) = show x - show (VarE x) = x ++ " ; var" - show NilE = "nil" +-- instance Show Expr where +-- show (IntE x) = show x +-- show (VarE x) = x ++ " ; var" +-- show NilE = "nil"