chapter 6 exercise 6-1: reimplement frame and hcat by iterators