Skip to content
Bill Hails edited this page Nov 23, 2018 · 7 revisions

The special function here takes a function of one argument and passes it the current continuation as a function so that calling the current continuation is equivalent to returning through here. An example may make this clearer:

here(
    fn(ret) {
        if (ret(3)) {
            4
        } else {
            5
        }
    }
);

returns 3. The continuation is first class like any other function and can be passed to other functions, stored in variables, called later etc. The type of here is ((#a -> #b) -> #a) -> #a), see Type Notation for a discussion of this notation.

here is called call-with-current-continuation, or call/cc in other languages.

Up: Home

Next: Spawn

Clone this wiki locally