Skip to content

Instantly share code, notes, and snippets.

@JoeyEremondi
Created March 1, 2016 23:10
Show Gist options
  • Save JoeyEremondi/75f5bf25ca71c77b03fd to your computer and use it in GitHub Desktop.
Save JoeyEremondi/75f5bf25ca71c77b03fd to your computer and use it in GitHub Desktop.
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