eval: fixed first state forgetfulness issue (the prior commit didnt really fix it)

This commit is contained in:
2017-05-22 18:58:42 -04:00
parent 545d2896a1
commit c5edf4854f

View File

@@ -137,10 +137,10 @@ funCall state (BFun name args body) provided =
in callWith (M.insert a evald nstate) args provided
funCall state (BNative body) provided =
let (args, nstate) = callWith state provided
in (body args, state)
in (body args, nstate)
-- TODO: make tail recursive with accumulator
where callWith state [] = (state, [])
where callWith state [] = ([], state)
callWith state (x:xs) =
let (evald, nstate) = eval state x
(retstate, l) = callWith nstate xs
in (retstate, evald:l)
(l, retstate) = callWith nstate xs
in (evald:l, retstate)