99 Elm Problems/Problem 4/Solutions
Jump to navigation
Jump to search
Solution 1: Recursive version
myLength list =
case list of
[] -> 0
head :: tail -> 1 + myLength tail
Solution 2: Using List.foldl
myLength = List.foldl (\_ b -> b + 1) 0