Question

Maybe my question has a really simple answer, but I cannot find it.

In Scheme R6RS how can I built a continuation that does nothing and requires any arguments?

My goal is to have a continuation, let's name it QUIT such that if I have the following code:

((lambda ()
  (display 1)
  (display 2)
  (QUIT)
  (displey "A")))

it preints 1 and 2 but not "A".+

Can you help me?

Thank you.

Was it helpful?

Solution

The most straightforward way is to use a simple "return" style continuation:

(call/cc (lambda (return) 
    (display 1) 
    ...
    (return) 
    (display "A")))

Does that help at all?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top