[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: continuations

Kevin, let me suggest you go back to the source. Although it isn't always
the best way to understand something, in some contexts it helps. This is
one of them.

Let me recommend that you read up on the papers from the Indiana School of
Scheme thought. The people there explored all kinds of uses for
continuations and even wrote plain text books on them -- starting in the
early 80s. That includes: Dan Friedman, Mitch Wand, Will Clinger, Kent
Dybvig, Chris Hanyes, Bruce Duba, Eugene Kohlbecker, and myself.  [Bruce
went to Bell Labs for a year, and snuck callcc into SML/NJ, which is why
some ML's now have continuations.]

Based on a decade of work on this stuff, Dan Friedman was invited to
deliver an invited POPL lecture on continuations. He did so and wrote 
it up as an Indiana technical report entitled 

  Applications of Continuations (IU TR 237, 1988)
  [also see his text book with G. Springer]

What kind of uses do continuations have? Here is a list: 

  recursion exits
  cross-tree searches (angels and devils)
  Prolog-style backtracking 
  Icon-style generators 
  threads, preemptive and non-preemptive 
  engines (time preempted threads, simulations of multi-threading)
  dialog suspensions

I strongly recommend that you understand each and everyone of them, 
along the suggested line. You will understand programming with
continuations intimately then and use it whenever you need it. 

You must start with asking the very simple question of why Schemers use 

 (call/cc (lambda (k) ... ))
 (let/cc k ...)

and not 


Enjoy -- Matthias ["the abdicated king of continuations", Phil Wadler]