mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
4b ex 1
This commit is contained in:
+4
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user