Last active
March 5, 2016 17:59
-
-
Save amitaibu/a7187ebd5a88c9738203 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myMaximumBy :: (a -> a -> Ordering) -> [a] -> a | |
myMaximumBy _ [] = undefined | |
myMaximumBy _ (x : []) = x | |
myMaximumBy f (x : xs) = | |
case f x val of | |
GT -> x | |
_ -> val | |
where val = (myMaximumBy f xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment