[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
continuation?
From: |
Seong-Kook Shin |
Subject: |
continuation? |
Date: |
Sat, 26 Jan 2002 16:51:06 +0900 (KST) |
Hi.
First of all, I have to say thank you very much those whom
have answered my trivial questions so far.
I cannot understand what the meaning of `continuation', and
how to do with `call-with-current-continuation'.
I've read several guile documents in addition to the book,
`The Scheme Programming Language -ANSI SCHEME-', but
I could understand neither.
Is there anyone can explain the basic idea of `continuation'
and can show some simple, brief and fullly explained example?
Or just let me know which document or book will be a good start.
In addition, the book says:
call/cc must be passed a procedure P of one argument.
call/cc obtains the current continuation add passes
it to P. The continuation itself is represented by a
procedure K. Each time K is applied to a value, it
returns the value to the continuation of the call/cc
application.
(1) What's the exact meaning of `application' in the above
quotation? I suppose that meaning might be the same which
can be found in the Scheme grammer (also found in the book):
<application> -> (<expression> <expression>*)
Right?
(2) What's the exact meaning of *CURRENT* continuation?
Does it mean the expression that will be evaluate next?
For example:
(call/cc
(lambda (k)
(* 5 (k 4))))
=>4
I think that the `current continuation' of above code
is "(call/cc (lambda ...))" itself. Right?
(3) What's wrong in this code?
(call/cc
(lambda (k)
(* 5 k)))
=> ABORT: (wrong-type-arg)
In the code of question 2, 3, "call/cc" is an abbreviation of
"call-with-current-continuation" as you expected.
--
C-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Korean version: http://pcrc.hongik.ac.kr/~cinsk/
- continuation?,
Seong-Kook Shin <=