Administrator approval is now required for registering new accounts. If you are registering a new account, and are external to the University, please ask the repository owner to contact ServiceLine to request your account be approved. Repository owners must include the newly registered email address, and specific repository in the request for approval.

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
......@@ -39,7 +39,11 @@ eval env expr = let (eval', evalFull') = (eval env, evalFull env) in case expr o
_ -> 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 env (Set xs) = Set (map (eval env) xs) -- evaluates expression fully (not just weak head normal form)
......
......@@ -47,6 +47,7 @@ SetFuncCalls : SetFuncCall {[$1]}
| SetFuncCall';' SetFuncCalls {$1:$3}
SetFuncCall : filter '['SetName']' '('Func')' {FuncCall (PredefFunc Filter) [Var $3] [$6]}
| filter '('Func')' {FuncCall (PredefFunc Filter) [] [$3]}
Func : '\\' '(' VarNames ')' "->" Expr {FuncDef [] $3 $6}
......
......@@ -2,4 +2,4 @@
SampleSet
.out
filter[SampleSet](\(r) -> r[0] == "hello")
\ No newline at end of file
filter (\(r) -> r[0] == "hello")
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment