The fundamental concept of continuations

Barb Knox see at sig.below
Tue Oct 9 01:59:28 EDT 2007


In article <1191906949.179197.217470 at 57g2000hsv.googlegroups.com>,
 gnuist006 at gmail.com wrote:

> Again I am depressed to encounter a fundamentally new concept that I
> was all along unheard of.

Don't be depressed about that.  There are countless concepts out there 
they you haven't yet heard of.

> Its not even in paul graham's book where i
> learnt part of Lisp. Its in Marc Feeley's video.
> 
> Can anyone explain:
> 
> (1) its origin

Lambda calculus.  Instead of function A returning to its caller, the 
caller provides an additional argument (the "continuation") which is a 
function B to be called by A with A's result(s).  In pure "continuation 
style" coding, nothing ever "returns" a result.

It is easy to mechanically transform normal function-style lambda 
calculus into continuation-style, but the reverse is not so.

> (2) its syntax and semantics in emacs lisp, common lisp, scheme
> (3) Is it present in python and java ?

Java, sort of.  For example, the Run interface.
Python, I don't know.

> (4) Its implementation in assembly. for example in the manner that
> pointer fundamentally arises from indirect addressing and nothing new.
> So how do you juggle PC to do it.

You can have a "spaghetti stack", or keep continuation data-structures 
in the heap.

> (5) how does it compare to and superior to a function or subroutine
> call. how does it differ.

This sounds like homework.  What do you have so far?

> Thanks a lot.
> 
> (6) any good readable references that explain it lucidly ?

Google?

-- 
---------------------------
|  BBB                b    \     Barbara at LivingHistory stop co stop uk
|  B  B   aa     rrr  b     |
|  BBB   a  a   r     bbb   |    Quidquid latine dictum sit,
|  B  B  a  a   r     b  b  |    altum viditur.
|  BBB    aa a  r     bbb   |   
-----------------------------



More information about the Python-list mailing list