This commit is contained in:
Aaro Koivukangas
2025-12-22 20:57:13 +02:00
parent 9259940bf4
commit 5b03b871c1
+4 -1
View File
@@ -21,7 +21,10 @@ import Mooc.Todo
countNothings :: [Maybe a] -> Int
countNothings xs = foldr countHelper 0 xs
countHelper = todo
countHelper :: Maybe a -> Int -> Int
countHelper x acc = case x of
Nothing -> acc+1
Just _ -> acc
------------------------------------------------------------------------------
-- Ex 2: myMaximum with a fold. Just like in the previous exercise,