Skip to main content

Questions tagged [continuation]

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 ...
wlad's user avatar
  • 101
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 ...
Anon's user avatar
  • 3,633
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 ...
hgiesel's user avatar
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 ...
Jules's user avatar
  • 17.9k
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. ...
Giorgio's user avatar
  • 19.8k
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 ...
David Cowden's user avatar
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: ...
Lorenzo Dematté's user avatar
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 ...
John Cartwright's user avatar
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 ...
nicolas's user avatar
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 ...
user avatar
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 ...
Heinzi's user avatar
  • 9,868

close