续体
引用与注释

↑  
Alonzo Church. . Annals of Mathematics studies, no. 6. Lithoprinted. Princeton University Press, Princeton. 1941  [2021-09-24]. （原始内容存档于2022-05-19）.
↑  
Gerald J. Sussman, Guy L. Steele Jr. . 1976  [2021-11-11]. （原始内容存档于2022-04-10）.  “ Reynolds uses the term "continuation" in [Reynolds 72]. Church clearly understood the use of continuations; it is the only way to get anything accomplished at all in pure lambda calculus! For example, examine his definition of ordered pairs and triads on page 30 of [Church 41]. In SCHEME notation. this is:

  [M, N] means (LAMBDA (A) (A M N))

  21 means (LAMBDA (A) (A (LAMBDA (B C) B)))

  22 means (LAMBDA (A) (A (LAMBDA (B C) C)))

where 21 e.g. selects the first element of a pair. (Note that these functions are isomorphic to CONS, CAR, and CDR!) ”
↑  Adriaan van Wijngaarden.  (PDF). 1966  [2024-02-24]. （原始内容存档 (PDF)于2024-02-24）.
↑  .   [2024-02-24]. （原始内容存档于2024-02-24）.
↑  Palmer, Luke. . perl.perl6.language (newsgroup). June 29, 2004  [2009-10-04]. （原始内容存档于2013-06-06）.
↑  Kent M. Pitman（英语：）. . 1983, 2007  [2021-10-15]. （原始内容存档于2021-12-21）. Historically, (CATCH form) evolved to handle the fact that programmers were using (ERRSET (...(ERR)...)) to accomplish non-local returns since there was once no other way to get that functionality. CATCH and THROW were introduced so that programmers could write (CATCH (...(THROW val)...)) instead where there was really no error condition. However, it was found that confusion would often result using unlabelled CATCH/THROW because an unlablled CATCH could catch a throw it hadn't intended to. This is why named CATCH was invented.  请检查|date=中的日期值 (帮助)
Gerald J. Sussman, Guy L. Steele Jr..  . 维基文库. 1975 （英文）. CATCH － This is the "escape operator" which gives the user a handle on the control structure of the interpreter. The expression:
(CATCH <identifier> <expression>)
evaluates <expression> in an environment where <identifier> is bound to a continuation which is "just about to return from the CATCH"; that is, if the continuation is called as a function of one argument, then control proceeds as if the CATCH expression had returned with the supplied (evaluated) argument as its value. ……
As another example, we can define a THROW function, which may then be used with CATCH much as they are in LISP:
(DEFINE THROW (LAMBDA (TAG RESULT) (TAG RESULT)))
↑  William Clinger, Daniel P. Friedman, Mitchell Wand.  (PDF). 1985  [2021-10-14]. （原始内容存档 (PDF)于2022-01-21）.
↑  Bruce Duba, Robert Harper, David MacQueen.  (PDF). 1991  [2021-10-11]. （原始内容存档 (PDF)于2022-01-29）.
↑  .   [2021-10-11]. （原始内容存档于2012-03-30）.
↑  .   [2024-01-20]. （原始内容存档于2024-03-06）. Async methods are intended to be non-blocking operations. An await expression in an async method doesn't block the current thread while the awaited task is running. Instead, the expression signs up the rest of the method as a continuation and returns control to the caller of the async method.
↑  .   [2021-10-11]. （原始内容存档于2012-03-23）.
↑  .   [2021-10-11]. （原始内容存档于2021-12-25）.
↑  S. B. Wample, R. E. Griswold（英语：）. . The Computer Journal, Volume 26, Issue 1, Pages 72–78. 1983.
↑  .   [2021-10-11]. （原始内容存档于2021-10-26）.
↑  javaflow （页面存档备份，存于） (requires bytecode manipulation at runtime or compile time)
↑  .   [2021-10-11]. （原始内容存档于2013-08-06）.
↑  Continuity
↑  .   [2021-10-11]. （原始内容存档于2016-04-13）.
↑  
Michael J. Fischer（英语：）. . In Proceedings of an ACM Conference on Proving Assertions about Programs (1972) 104–109. 1972. Definition 4.3: A schema p is safe if for every subformula of the form q = (q0, q1, …, qn), either q0∈ {\mathcal {F}} or for all i, 0≤i≤n, qi is a lambda-function, a constant or a variable.
Thus, in a safe schema, we prohibit the value returned by an application or conditional from being passed on to another function as an argument. It follows that such a value can never be evaluated and must eventually propagate to the top level to become the final result of the whole evaluation. One can then show:
Lemma 4.2: Let f be a safe lambda-function. Then fcnd(f) = fcnr(f).
We are now in a position to state the main theorem in precise terms.
Theorem I: Let f be any lambda function. We can effectively find a lambda-function f' such that fcnd(f') = fcnr(f') = fcnr(f) for all interpretations.
Proof (sketch): By assumption, f = (λx1…xn.p) for some schema p with free variables x1, …, xn. Using well-known techniques, we can first find a schema p1 such that …… .
We now define a function Φ to translate p1 into a safe form p2, and p2 will be such that fcnr((λx1…xn.p)) = fcnd((λx1…xn.(p2 (λx.x)))). We then take f' = (λx1…xn.(p2 (λx.x))). ……
Thus, our idea is to modify the schema so that for any sub-lambda-function g, instead of g passing its result back to the caller, the caller is passed to g as an additional functional argument, g then applies the new argument to the result it used to return, thereby avoiding the necessity of returning immediately. ……
In the definition of Φ, we also use the auxiliary function Ψ which adds the new argument to a lambda-function and translates its body. ……
Examples:
⑴ Φ[x] = (λf.(f x)), x∈ {\mathcal {X}}.
⑵ Φ[(x y)] = (λf.((λf.(f x)) (λh.((λf.(f y)) (λx.(h f x)))))), x,y∈ {\mathcal {X}}.
⑶ Φ[(λx.a)] = (λf.(f (λgx.((λf.(f a)) g)))), x∈ {\mathcal {X}}, a∈ \mathrm {C} .
⑷ Ψ[(λx.a)] = (λgx.((λf.(f a)) g)), x∈ {\mathcal {X}}, a∈ \mathrm {C} .
↑  John C. Reynolds. . 1972  [2024-02-24]. （原始内容存档于2024-02-24）. Now suppose we define an expression to be serious if there is any possibility that its evaluation might not terminate. Then a sufficient condition for order-of-application independence is that a program should contain no serious operands or declaring expressions.
Next, suppose that we can divide the functions which may be applied by our program into serious functions, whose application may sometimes run on forever, and trivial functions, whose application will always terminate. …… Then an expression will only be serious if its evaluation can cause the application of a serious function, and a program will be independent of order-of-application if no operand or declaring expression can cause such an application. ……
As can be seen with a little thought, the condition implies that whenever some function calls a serious function, the calling function must return the same result as the called function, without performing any further computation. But any function which calls a serious function must be serious itself. Thus by induction, as soon as any serious function returns a result, every function must immediately return the same result, which must therefore be the final result of the entire program.
Nevertheless, there is a method for transforming an arbitrary program into one which meets our apparently restrictive condition. …… Basically, one replaces each serious function fold (except the main program) by a new serious function fnew which accepts an additional argument called a continuation. The continuation will be a function itself, and fnew is expected to compute the same result as fold, apply the continuation to this result, and then return the result of the continuation, i.e.,
  fnew(x1, …, xn, c) = c(fold(x1, …, xn)).
This introduction of continuations provides an additional "degree of freedom" which can be used to meet our condition for order-of-evaluation independence. Essentially, instead of performing further actions after a serious function has returned, one imbeds the further actions in the continuation which is passed to the serious function.
↑  
Carl Hewitt, Peter Bishop, Irene Greif, Brian Smith, Todd Matson, Richard Steiger. . 1973  [2022-11-15]. （原始内容存档于2022-11-15）.  “For some years we have been constructing a series of languages to express our evolving understanding of the above semantic issues. The latest of these
is called PLANNER-73. ……

We shall assume that the reader is familiar with advanced pattern matching languages such as SNOBOL4, CONVERT, PLANNER-71, QA4, and POPLER.

We shall use (%A M%) to indicate sending the message M to the actor A. We shall use [s1 s2 … sn] to denote the finite squence s1, s2, … sn. ……

Identifiers can be created by the prefix operator =. ……

An expression (=> pattern body) is an abbreviation for (receive(message pattern) body) where receive is a more general actor that is capable of bindinq elements of the action in addition to the message.

Evaluating 

  (%(=> pattern body) the-message%), i.e. sending

  (=> pattern body) the-message,

will attempt to match the-message against pattern, If the-message is not of the form specified by pattern, then the actor is NOT-APPLICABLE to the-message. If the-message matches pattern, the body is evaluated.
……

Conceptually at least a new actor is created every time a message is sent. Consider sending to a target T a message M and a continuation C.

(send T
    (message M
        [#continuation C]))

The transmission (%T M%) is an abbreviation for the above where C is defaulted to be the caller. If target T is the following:
(receive
    (message the-body
        [#continuation =the-continuation])
    the-body)

then the the-body is evaluated in an environment where the-message is bound to M and the-continuation is bound to C.
……

Many actors who are executing in parallel can share the same continuation. They can all send a message [“return”] to the same continuation. ”
↑  Gerald J. Sussman, Guy L. Steele Jr.  . 维基文库. 1975 （英文）. It is always possible, ……to perform any calculation in this way: rather than reducing to its value, it reduces to an application of a continuation to its value (cf. [Fischer]). That is, in this continuation-passing programming style, a function always "returns" its result by "sending" it to another function.
↑  Gerald J. Sussman, Guy L. Steele Jr.  . 维基文库. 1975 （英文）. We believe that functional usage, where applicable (pun intended), is more perspicuous than continuation-passing.
↑  
这组代码也可以选用冗余但普适的弹跳床（英语：）语义的调度过程：
(define (schedule)
  (let loop ()
    (if (not (null? *ready-list*)) (begin
      (call/cc (lambda (return)
        (let ((cont (car *ready-list*)))
          (set! *ready-list* 
            (cons return (cdr *ready-list*)))
          (cont #f))))
      (loop)))))