Questions tagged [continuation]
The continuation tag has no summary.
11 questions
0votes
1answer
301views
Simple tic-tac-toe GUI in Common Lisp: Avoid using Continuation Passing Style?
I've made a simple Tic-Tac-Toe game in Common Lisp using the Ltk library. One of the things I wanted to do was to support CPU vs CPU, human vs human, human vs CPU, and CPU vs human. Also, possibly ...
13votes
7answers
12kviews
Best practice to "continue" from inside a nested loop?
Here is a simplified sample. Basically, it does checks on a string from a string list. If the check passes, it will remove that string (filterStringOut(i);), and it is no longer ...
6votes
1answer
1kviews
What's the relation between Promises and Continuations
I think I understand what Promises are about, and I think I understand what continuations are about, but I still fail to see what their connection is. In what ways do Promises use Continuations. They ...
12votes
3answers
2kviews
Are first-class continuations useful in modern object-oriented programming languages?
Continuations are extremely useful in functional programming languages (e.g. the Cont monad in Haskell) because they allow a simple and regular notation for imperative-style code. They're also useful ...
1vote
1answer
1kviews
Continuations, coroutines, and tail-call optimization
I am trying to learn continuations and use them to implement coroutines in Scheme. I have two procedures (coroutines) a and b, and I switch between them in the following way: ;; c is a continuation. ...
17votes
4answers
3kviews
What is an example of a continuation not implemented as a procedure?
An interesting discussion about the distinction between callbacks and continuations over on SO has prompted this question. By definition, a continuation is an abstract representation of the logic ...
24votes
3answers
4kviews
Which are the alternatives to using a stack to represent function call semantics?
We all know and love that function calls are usually implemented using the stack; there are frames, return addresses, parameters, the whole lot. However, the stack is an implementation detail: ...
4votes
1answer
123views
How is one expected to use open sockets with [delimited] continuations?
I'm trying to figure out how an open socket or file handle should interact with continuations. Searching has revealed that dynamic-wind is probably part of the solution, but I'm more interested in the ...
20votes
2answers
2kviews
Y combinator and tail call optimizations
The definition of a Y combinator in F# is let rec y f x = f (y f) x f expects to have as a first argument some continuation for the recursive subproblems. Using the y f as a continuation, we see ...
4votes
3answers
1kviews
Can't understand example using continuations
I'm reading the r6rs Scheme report and am confused by the explanation of continuations (I find it to be too dense and lacking of examples for a beginner). What is this code doing and how does it ...
11votes
4answers
3kviews
How do you keep code with continuations/callbacks readable?
Summary: Are there some well-established best-practice patterns that I can follow to keep my code readable in spite of using asynchronous code and callbacks? I'm using a JavaScript library that does ...