Open renovatorruler opened 3 years ago
Create a function called listLength which will take a List a and return the number of elements in the list.
listLength
List a
λ> listLength [123, 456, 789] 3 λ> listLength "Hello, world!" 13
listLength : List a -> Int listLength xs = case xs of [] -> 0 head :: tail -> 1+listLength tail
Create a function called
listLength
which will take aList a
and return the number of elements in the list.