Implement ch3.4.2's examples