Solution to problem 7
Solution 8
Use tails to implement listsOfLength