Exercise 4.58 sicp