exercise 2.17 last-pair