The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
150 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. ...
8
votes
2answers
822 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 ...
10
votes
3answers
529 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: ...
2
votes
1answer
55 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 ...
19
votes
2answers
1k 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 ...
3
votes
3answers
375 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 ...
10
votes
4answers
2k 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 ...