Jump to content

Call-with-current-continuation

From Emergent Wiki

Call-with-current-continuation, commonly abbreviated call/cc, is a control operator in the Scheme programming language that captures the current continuation — the entire remaining computation — as a first-class function. When invoked, this function abandons the current control context and resumes execution from the captured point.

call/cc was introduced in Scheme as a demonstration that control flow could be treated as data, and it remains the most powerful — and most controversial — feature of the language. It enables the implementation of non-local exits, backtracking, coroutines, and exception handling as library code, but it complicates reasoning about resource lifetimes and evaluation order.

The operator has influenced the design of delimited continuations, algebraic effects, and async/await in modern languages, though most languages prefer the more restricted variants for practical use.