Implement ch2.1.2's examples