Recursions on more complicated datatypes
Recursions on more complicated datatypes
Definition of the datatype list is recursive. So,when we define a function for such datatypes, it comes naturally to define the function recursively.
length' :: forall a . [a] -> Integer
length' [] = 0
length' [x|xs] = 1 + length xs
> length' "hamler"
6
