Content deleted Content added
Added references to Scheme generators. |
Pi Delport (talk | contribs) tone down scheme focus a bit, introduce new-style references |
||
Line 33:
In Python, a generator can be thought of as an iterator that contains a frozen [[stack frame]]. Whenever the iterator's <code>next()</code> method is called, Python resumes the frozen frame, which executes normally until the next <code>yield</code> statement is reached. The generator's frame is then frozen again, and the yielded value is returned to the caller.
Generators can be implemented in terms of more expressive [[control flow]] constructs, such as [[coroutine]]s or first-class [[continuation]]s.<ref>{{cite web
| last = Kiselyov
| first = Oleg
| month = January
| year = 2004
| title = General ways to traverse collections in Scheme
}}</ref>
==See also==
Line 45 ⟶ 52:
==References==
<references/>
* Stephan Murer, [[Steve Omohundro | Stephen Omohundro]], David Stoutamire and Clemens Szyperski: Iteration abstraction in Sather. ''ACM Transactions on Programming Languages and Systems'', 18(1):1-15 (1996) [http://portal.acm.org/citation.cfm?doid=225540.225541]
Line 51 ⟶ 60:
** [http://python.org/peps/pep-0289.html PEP 289: ''Generator Expressions'']
** [http://www.python.org/peps/pep-0342.html PEP 342: ''Coroutines via Enhanced Generators'']
▲** [http://okmij.org/ftp/Scheme/enumerators-callcc.html General ways to traverse collections in Scheme] by Oleg Kiselyov
[[Category:Programming constructs]]
|