Maciek Pasternacki <maciekp@japhy.fnord.org> wrote:
+---------------
| Jon Harrop wrote:
| > Lisp has some interesting features that separate it from many other
| > programming languages. In contrast, there is nothing interesting about the
| > Python language, AFAIK.
|
| One word: yield. It's only thing I miss from Python when programming
| Lisp.
|
| With generators, I can think and write in terms of generating sequence
| and not carry about state. I get transparent co-programs for free.
| Yes, there is Arnesi CPS transformer-based emulation of generators,
| but CPS transofmation gives inefficient code (function body is parsed
| into set of structures and evaluated by hand) and has some major
| caveats (no way of handling conditions within WITH-CALL/CC).
+---------------
A fully-general CALL/CC is not necessary. In any Common Lisp
implementations with threads (and it doesn't really matter whether
it's OS threads or "green" threads [coroutines] as in CMUCL),
you can implement "proper" generators with a natural YIELD function
fairly easily. E.g., look at the MP:PROCESS-YIELD function in
implementations with CLIM-like threads.
And you can handle conditions within your generator threads however
you like...
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607