aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordan <[email protected]>2024-04-20 19:43:40 -0400
committerdan <[email protected]>2024-04-20 19:43:40 -0400
commit15bb4b35de62205b4cd077ed4d8efcf1cc0ebd39 (patch)
treea0b251975fd355e735080b10b85182e9c8ba5766
parente43a960667914a46d671c9cf1801a53d26385568 (diff)
downloadbizexp-15bb4b35de62205b4cd077ed4d8efcf1cc0ebd39.tar.gz
bizexp-15bb4b35de62205b4cd077ed4d8efcf1cc0ebd39.tar.bz2
bizexp-15bb4b35de62205b4cd077ed4d8efcf1cc0ebd39.zip
feat: add floor and not functionsHEADmaster
-rwxr-xr-xsrc/BizExpr.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/BizExpr.hs b/src/BizExpr.hs
index b11ffc1..b199c15 100755
--- a/src/BizExpr.hs
+++ b/src/BizExpr.hs
@@ -119,8 +119,16 @@ getFunc "sum" = Just eSum
getFunc "any" = Just eAny
getFunc "all" = Just eAll
getFunc "average" = Just eAverage
+getFunc "floor" = Just eFloor
+getFunc "not" = Just eNot
getFunc _ = Nothing
+eFloor :: [Value] -> Maybe Value
+eFloor (v:_) = IntVal <$> (floor <$> (coerceTo v :: Maybe Float))
+
+eNot :: [Value] -> Maybe Value
+eNot (v:_) = BoolVal <$> (not <$> coerceTo v)
+
eSum :: [Value] -> Maybe Value
eSum = eFold (+) (0.0 :: Float)