Handbook
Glossary
with-return ( quot -- )
Factor handbook
»
The language
»
Continuations
Prev:
attempt-all ( ... seq quot: ( ... elt -- ... obj ) -- ... obj )
Next:
Continuation implementation details
Vocabulary
continuations
Inputs
quot
a
quotation
Outputs
None
Word description
Captures a continuation that can be reified by calling the
return
word. If so, it will resume execution immediately after the
with-return
word. If
return
is not called, then execution proceeds as if this word were simply
call
.
Examples
Only "Hi" will print:
USING: prettyprint continuations io ; [ "Hi" print return "Bye" print ] with-return
Hi
See also
return
Definition
USING:
kernel
namespaces
;
IN:
continuations
:
with-return
( quot -- )
[
return-continuation
]
dip
[
with-variable
]
2curry
callcc0
;
inline