1 Answers

In the Scheme computer programming language, the procedure call-with-current-continuation, abbreviated call/cc, is used as a control flow operator. It has been adopted by several other programming languages.

Taking a function f as its only argument, within an expression is applied to the current continuation of the expression.For example e2] is equivalent to applying f to the current continuation of the expression. The current continuation is given by replacing by a variable c bound by a lambda abstraction, so the current continuation is ]. Applying the function f to it gives the final result ]].

As a complementary example, in an expression ], the continuation for the sub-expression is ], so the whole expression is equivalent to ]].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. When a continuation object is applied to an argument, the existing continuation is eliminated and the applied continuation is restored in its place, so that the program flow will continue at the point at which the continuation was captured and the argument of the continuation then becomes the "return value" of the call/cc invocation. Continuations created with call/cc may be called more than once, and even from outside the dynamic extent of the call/cc application.

In computer science, making this type of implicit program state visible as an object is termed reification.

4 views

Related Questions

What is Turbidity current?
1 Answers 4 Views
What is Electric current?
1 Answers 4 Views
What is Direct current?
1 Answers 5 Views
What is Current sensing?
1 Answers 4 Views
What is Earnings call?
1 Answers 4 Views
What is Continuation novel?
1 Answers 8 Views
What is Call report?
1 Answers 4 Views
What is BIOS interrupt call?
1 Answers 4 Views
What is Conference call?
1 Answers 4 Views