Skip to content
Snippets Groups Projects
Commit 492e7639 authored by pm3g19's avatar pm3g19
Browse files

Able to omit set name if set function takes in last output result

parent c29081a8
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,11 @@ eval env expr = let (eval', evalFull') = (eval env, evalFull env) in case expr o ...@@ -39,7 +39,11 @@ eval env expr = let (eval', evalFull') = (eval env, evalFull env) in case expr o
_ -> expr _ -> expr
evalControl1 :: Environment -> Expr -> Expr evalControl1 :: Environment -> Expr -> Expr
evalControl1 env (Control _ (currentExpr:exprs)) = let output = eval env currentExpr in Control output exprs evalControl1 env (Control last (currentExpr:exprs)) = let output = eval env currentExprFull in Control output exprs
where
currentExprFull = case currentExpr of
(FuncCall func [] args) -> FuncCall func [last] args
_ -> currentExpr
evalFull = eval evalFull = eval
--evalFull env (Set xs) = Set (map (eval env) xs) -- evaluates expression fully (not just weak head normal form) --evalFull env (Set xs) = Set (map (eval env) xs) -- evaluates expression fully (not just weak head normal form)
......
...@@ -47,6 +47,7 @@ SetFuncCalls : SetFuncCall {[$1]} ...@@ -47,6 +47,7 @@ SetFuncCalls : SetFuncCall {[$1]}
| SetFuncCall';' SetFuncCalls {$1:$3} | SetFuncCall';' SetFuncCalls {$1:$3}
SetFuncCall : filter '['SetName']' '('Func')' {FuncCall (PredefFunc Filter) [Var $3] [$6]} SetFuncCall : filter '['SetName']' '('Func')' {FuncCall (PredefFunc Filter) [Var $3] [$6]}
| filter '('Func')' {FuncCall (PredefFunc Filter) [] [$3]}
Func : '\\' '(' VarNames ')' "->" Expr {FuncDef [] $3 $6} Func : '\\' '(' VarNames ')' "->" Expr {FuncDef [] $3 $6}
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
SampleSet SampleSet
.out .out
filter[SampleSet](\(r) -> r[0] == "hello") filter (\(r) -> r[0] == "hello")
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment