Implement ch4.1.7's examples