From: Mart Lubbers Date: Tue, 12 May 2015 17:32:11 +0000 (+0200) Subject: small update fix X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=04fdced12be9722608dbff8b46fd2c6663599dc0;p=fp1415.git small update fix --- diff --git a/fp2/week45/mart/RefactorX.dcl b/fp2/week45/mart/RefactorX.dcl index e71f36b..e7fef07 100644 --- a/fp2/week45/mart/RefactorX.dcl +++ b/fp2/week45/mart/RefactorX.dcl @@ -1,5 +1,6 @@ definition module RefactorX +from StdClass import class toString import StdEnv :: Expr = NR Int | VAR Name | OP Expr Operator Expr | LET Name Expr Expr @@ -7,7 +8,6 @@ import StdEnv :: Operator = PLUS | MIN | MUL | DIV :: Val = Result Int | Undef -from StdClass import class toString instance toString Expr free :: Expr -> [Name] diff --git a/fp2/week45/mart/RefactorX.icl b/fp2/week45/mart/RefactorX.icl index 3898c14..1334aac 100644 --- a/fp2/week45/mart/RefactorX.icl +++ b/fp2/week45/mart/RefactorX.icl @@ -57,9 +57,8 @@ apply o (Result e1) (Result e2) = Result (apply` o e1 e2) apply` MUL = * apply` DIV = / - eval:: Expr -> Val -eval e = eval` (remove_unused_lets e) [] +eval e = eval` e [] where eval`:: Expr [(Name, Val)] -> Val eval` (NR n) _ = Result n