Implement ch2.2.2's examples