Implement ch2.1.4's examples