call-with-current-continuation


call-with-current-continuation

(Lisp, programming)(call/cc) A Lisp control function thattakes a function f as its argument and calls f, passing it thecurrent continuation, which is itself a function, k. k,which represents the context of the call to call/cc, takes theresult of call/cc (which is the result of f) and returns thefinal result of the whole program. Thus if, for example, thefinal result is to print the value returned by call/cc thenanything passed to k will also be printed.

E.g, in Scheme:

(define (f k)(k 1)(k 2)3)

(display (call-with-current-continuation f))

Will display 1.