Implement ch2.5.2's examples