From 0e60863bc506b0008fc2ee4431106b3dd1922920 Mon Sep 17 00:00:00 2001 From: darkf Date: Sun, 27 Oct 2013 01:27:08 -0700 Subject: [PATCH] loop now takes a required value and passes the returned non-false value into the function --- interp.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/interp.hs b/interp.hs index b8e4ebd..07ccb44 100644 --- a/interp.hs +++ b/interp.hs @@ -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")]),