mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
4b ex2
This commit is contained in:
+2
-1
@@ -38,7 +38,8 @@ myMaximum :: [Int] -> Int
|
|||||||
myMaximum [] = 0
|
myMaximum [] = 0
|
||||||
myMaximum (x:xs) = foldr maxHelper x xs
|
myMaximum (x:xs) = foldr maxHelper x xs
|
||||||
|
|
||||||
maxHelper = todo
|
maxHelper :: Int -> Int -> Int
|
||||||
|
maxHelper x acc = if x > acc then x else acc
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
-- Ex 3: compute the sum and length of a list with a fold. Define
|
-- Ex 3: compute the sum and length of a list with a fold. Define
|
||||||
|
|||||||
Reference in New Issue
Block a user