Implement ch3.1.2's examples