Last active
July 27, 2016 03:15
-
-
Save mblarsen/f53980eb5cb934b017c61840bca6dacc to your computer and use it in GitHub Desktop.
99 Elm problems — My solutions (solution only listed if different from others)
This file contains 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
elementAt : List a -> Int -> Maybe a | |
elementAt xs n = | |
case List.drop (n - 1) xs of | |
[ ] | |
-> Nothing | |
y::ys | |
-> Just y |
This file contains 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
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