start of chapter 8

my attempts at figuring out the programs introduced in the chapter