Lesson plan

call-with-current-continuation

In the Scheme computer programming language, the procedure call-with-current-continuation, abbreviated call/cc, is used as a control flow operator. It has also been adopted by several other programming languages. Taking a function f as its only argument, (call/cc f) within an expression is applied to the current continuation of the expression. For example ((call/cc f) e2) is equivalent to applying f to the current continuation of the expression. The current continuation is given by replacing (call/cc f) by a variable c bound by a lambda abstraction, so the current continuation is (lambda (c) (c e2)) . Applying the function f to it gives the final result (f (lambda (c) (c e2))) . As a complementary example, in an expression (e1 (call/cc f)) , the continuation for the sub-expression (call/cc f) is (lambda (c) (e1 c)) , so the whole expression is equivalent to (f (lambda (c) (e1 c))) . In other words, it takes a "snapshot" of the current control context or control state of the program as an object and applies f to it. The continuation object is a first-class value and is represented as a function, with function application as its only operation.…

Back to article

Article summary

In the Scheme computer programming language, the procedure call-with-current-continuation, abbreviated call/cc, is used as a control flow operator. It has also been adopted by several other programming languages. Taking a function f as its only argument, (call/cc f) within an expression is applied to the current continuation of the expression. For example ((call/cc f) e2) is equivalent to applying f to the current continuation of the expression. The current continuation is given by replacing (call/cc f) by a variable c bound by a lambda abstraction, so the current continuation is (lambda (c) (c e2)) . Applying the function f to it gives the final result (f (lambda (c) (c e2))) . As a complementary example, in an expression (e1 (call/cc f)) , the continuation for the sub-expression (call/cc f) is (lambda (c) (e1 c)) , so the whole expression is equivalent to (f (lambda (c) (e1 c))) . In other words, it takes a "snapshot" of the current control context or control state of the program as an object and applies f to it. The continuation object is a first-class value and is represented as a function, with function application as its only operation.…

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.