参考 http://tobyho.com/2013/06/16/what-are-generators/ 实现的例子