-
Notifications
You must be signed in to change notification settings - Fork 0
Here
Bill Hails edited this page Dec 6, 2023
·
12 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:
fn test(k) { k(3) }
here(
fn(k) {
if (test(k)) {
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)
.
here
is calledcall-with-current-continuation
, orcall/cc
in other languages.
CEKF(s) a.k.a. F Natural a.k.a F♮