Exercise 3.20: flatMap