Michael Chermside wrote: > > Andy writes: > > > I still have a hard time understanding continuations
BTW, if you *really* want to understand continuations, you need to carry out the following exercise: Write a Scheme interpreter in Scheme, doing it in a continuation-passing style. [1] You'll find that it's possible to do this using a subset of Scheme that doesn't itself have continuations, yet it will be trivially easy to make it so that your interpreter implements a Scheme that does. If you carry out this exercise successfully, and make it actually work, at some point along the way you will have a Zen-like flash of insight, and will suddenly understand exactly what a continuation is and how it works. (The other possibility is that you will still be none the wiser. If this happens, you will never understand continuations. Give up programming language implementation and become a potato farmer. :-) Footnote [1]: Continuation-passing style is where every call passes a function[2] telling the called function what to do with its result. No call ever returns. There is no difficulty with this in Scheme, because of tail recursion. Footnote [2]: These functions are not continuations in the sense we're talking about, they're just ordinary functions. So you can write in a continuation-passing style even if the language you're writing in doesn't have continuations. -- Greg _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com