Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [continuation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
271 views

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 ...
wlad's user avatar
  • 101
13 votes
7 answers
11k views

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 ...
Anon's user avatar
  • 3,613
5 votes
1 answer
1k views

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 ...
hgiesel's user avatar
  • 801
12 votes
3 answers
2k views

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 ...
Jules's user avatar
  • 17.8k
1 vote
1 answer
1k views

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. ...
Giorgio's user avatar
  • 19.7k
17 votes
4 answers
3k views

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 ...
David Cowden's user avatar
  • 2,903
23 votes
3 answers
4k views

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: ...
Lorenzo Dematté's user avatar
4 votes
1 answer
121 views

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 ...
John Cartwright's user avatar
20 votes
2 answers
2k views

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 ...
nicolas's user avatar
  • 349
4 votes
3 answers
1k views

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 ...
user avatar
11 votes
4 answers
3k views

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 ...
Heinzi's user avatar
  • 9,768