From 15bb4b35de62205b4cd077ed4d8efcf1cc0ebd39 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 20 Apr 2024 19:43:40 -0400 Subject: feat: add floor and not functions --- src/BizExpr.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/BizExpr.hs') 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) -- cgit v1.2.3