Implement ch4.1.2's examples