Skip to content

Instantly share code, notes, and snippets.

@mblarsen
Last active July 27, 2016 03:15
Show Gist options
  • Save mblarsen/f53980eb5cb934b017c61840bca6dacc to your computer and use it in GitHub Desktop.
Save mblarsen/f53980eb5cb934b017c61840bca6dacc to your computer and use it in GitHub Desktop.
99 Elm problems — My solutions (solution only listed if different from others)
elementAt : List a -> Int -> Maybe a
elementAt xs n =
case List.drop (n - 1) xs of
[ ]
-> Nothing
y::ys
-> Just y
countElements : List a -> Int
countElements xs =
List.map (always 1) xs |> List.sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment