From 883092e4ff4f8beb59e3d705ef247c235baa6bb7 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 10 Oct 2020 11:23:24 +0530 Subject: complete definition of naryBool i forgot to finish the function lol --- src/Operators.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Operators.hs b/src/Operators.hs index e607250..45be7f3 100644 --- a/src/Operators.hs +++ b/src/Operators.hs @@ -20,6 +20,8 @@ primitives = , ("=", comparator (==)) , ("!=", comparator (/=)) , ("not", unaryBool not) + , ("or", naryBool (||)) + , ("and", naryBool (&&)) ] data LispNumber = I Integer @@ -66,7 +68,9 @@ unaryBool op args naryBool :: (Bool -> Bool -> Bool) -> [Expr] -> LispResult Expr naryBool op args | length args < 2 = throwError $ ArgCount 2 args - + | otherwise = do + as <- mapM unwrapBool args + return . BoolLiteral $ foldl1 op as unwrapNum :: Expr -> LispResult LispNumber unwrapNum (IntLiteral n) = return $ I n -- cgit v1.2.3