chapter 3: generators