eval: fixed first state forgetfulness issue
This commit is contained in:
@@ -135,7 +135,12 @@ funCall state (BFun name args body) provided =
|
||||
callWith state (a:args) (p:provided) =
|
||||
let (evald, nstate) = eval state p
|
||||
in callWith (M.insert a evald nstate) args provided
|
||||
-- TODO: fix state forgetfulness
|
||||
funCall state (BNative body) provided =
|
||||
let args = map (fst . (eval state)) provided
|
||||
let (args, nstate) = callWith state provided
|
||||
in (body args, state)
|
||||
-- TODO: make tail recursive with accumulator
|
||||
where callWith state [] = (state, [])
|
||||
callWith state (x:xs) =
|
||||
let (evald, nstate) = eval state x
|
||||
(retstate, l) = callWith nstate xs
|
||||
in (retstate, evald:l)
|
||||
|
Reference in New Issue
Block a user