Exercise 1.31 in Guile Scheme