User Tools

Site Tools

This is an old revision of the document!

Continuation passing style

More commonly, functions return a value directly this is called the direct style.

λ continuation_passing_style-direct

Continuation passing style (CPS) is a style of programming where the control is passed directly as a continuation function. A function written in CPS takes an extra argument which is an explicit continuation, a function which takes the return result as a single argument.

λ continuation_passing_style-continuation

This makes some things more explicit, such as returning values. Which allows for more control over how these aspects of programming function. A simple example of control over returning values is delaying the time at which the value is returned.

λ continuation_passing_style-delayed

continuation_passing_style.1351061938.txt.gz · Last modified: 2015/02/02 08:24 (external edit)