Python programmers may be familiar with Python's yield keyword and generator functions. Python has built-in language support specifically for generator functions, whereas PLT Scheme does not. Can we invent our own then?
Ruby Garden has an entry on IterationStyles that has a comparison between Ruby and Python, which makes an interesting reference. I've classified this one under DataStructureRecipes until we can come up with a better place. Maybe there should be a whole chapter on how to emulate idioms from other programming languages?
-- GordonWeakliem - 10 Sep 2004
The following Web page "Generators in Icon, Python, and Scheme"
http://pobox.com/~oleg/ftp/Scheme/enumerators-callcc.html#Generators describes a different -- and a portable -- way of emulating generators in Scheme. Syntax-case macros are not required. The other sections of that page argue that enumerators provide generally a better interface for iterating over a (virtual) collection than generators do. One should also mention delimited continuations
(such as prompt/control or shift/reset -- which again seem superior to generators).
-- OlegK - 14 Sep 2004