loop now takes a required value and passes the returned non-false value into the function

This commit is contained in:
darkf 2013-10-27 01:27:08 -07:00
parent 44772d7e33
commit 0e60863bc5
1 changed files with 3 additions and 4 deletions

View File

@ -149,10 +149,9 @@ _itos v = error $ "itos: not an int: " ++ show v
_loop args@(TupleV [fn@(FnV _ _), arg]) = do
v <- apply fn arg
if v == BoolV True then
_loop args
else return UnitV
_loop fn@(FnV _ _) = _loop $ TupleV [fn, UnitV]
if v /= BoolV False then
_loop $ TupleV [fn, v]
else return v
initialState = ([stdout, stdin],
[M.fromList [("id", FnV emptyEnv [(VarP "x", Var "x")]),