Implement ch1.2.4's examples