Notes on how to define generators with extra state. cool stuff