Created
March 1, 2016 23:10
-
-
Save JoeyEremondi/75f5bf25ca71c77b03fd 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
maxNum : List ( comparable, number ) -> Maybe ( comparable, number ) | |
maxNum tuples = | |
case tuples of | |
x :: xs -> | |
Just | |
(List.foldl | |
(\(( _, count ) as tup) maxSoFar -> | |
if count > (snd maxSoFar) then | |
tup | |
else | |
maxSoFar | |
) | |
x | |
xs | |
) | |
_ -> | |
Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment