General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Hint

As in the previous exercises, we have to distinguish between empty and non-empty lists. The length of empty lists is obviously 0. We don't need any calculations to find this out. The length of non-empty lists is one more than the length of their tails. That is, if L is the length of the tail, the length if the list is L + 1. To state it more procedurally, if the input list is non-empty, calculate the length of the tail, then add 1 to it. That's the length of the input list.

Solution

Back to the exercise.