Shift/Reset Control Operators
The static delimited continuation operators shift and reset.
(require-extension shift-reset)
A "stuck on control" situation, a 'shift' without an enclosing 'reset', is an error.
Evaluate the body EXPRESSION ... with a delimited continuation. The body will contain one or more instances of (%shift ...)
.
Any use of (dynamic-wind ...)
within the dynamic scope of the partial continuation will be ignored!
Within the scope of EXPRESSION PC-TAG is bound to the reified partial continuation delimited by the enclosing (%reset ...)
. Provide a value to the partial continuation using the form (PC-TAG <something>)
.
Evaluate the body EXPRESSION ... with a delimited continuation. The body will contain one or more instances of (shift ...)
.
Within the scope of EXPRESSION PC-TAG is bound to the reified partial continuation delimited by the enclosing (reset ...)
. Provide a value to the partial continuation using the form (PC-TAG <something>)
.
Multiple value return version of (%reset ...)
. The body will contain one or more instances of (%shift-values ...)
.
Any use of (dynamic-wind ...)
within the dynamic scope of the partial continuation will be ignored!
Multiple value return version of (%shift ...)
. Provide a value to the partial continuation using the form (PC-TAG <something> ...)
.
Multiple value return version of (reset ...)
. The body will contain one or more instances of (shift-values ...)
.
Multiple value return version of (shift ...)
. Provide a value to the partial continuation using the form (PC-TAG <something> ...)
.
(require-extension bshift-breset)
Invalid delimited continuations, what RC-TAG below represents, and "stuck on control" will generate an error.
Evaluate the body EXPRESSION ... with a delimited continuation named RC-TAG. The body will contain one or more instances of (%bshift RC-TAG ...)
.
Any use of (dynamic-wind ...)
within the dynamic scope of the partial continuation will be ignored!
Within the scope of EXPRESSION PC-TAG is bound to the reified partial continuation delimited by the enclosing (%breset RC-TAG ...)
. Provide a value to the partial continuation using the form (PC-TAG <something>)
.
Evaluate the body EXPRESSION ... with a delimited continuation named RC-TAG. The body will contain one or more instances of (bshift RC-TAG ...)
.
Within the scope of EXPRESSION PC-TAG is bound to the reified partial continuation delimited by the enclosing (breset RC-TAG ...)
. Provide a value to the partial continuation using the form (PC-TAG <something>)
.
Multiple value return version of (%breset ...)
. The body will contain one or more instances of (%bshift-values RC-TAG ...)
.
Any use of (dynamic-wind ...)
within the dynamic scope of the partial continuation will be ignored!
Multiple value return version of (%bshift ...)
. Provide a value to the partial continuation using the form (PC-TAG <something> ...)
.
Multiple value return version of (breset ...)
. The body will contain one or more instances of (bshift-values RC-TAG ...)
.
Multiple value return version of (bshift ...)
. Provide a value to the partial continuation using the form (PC-TAG <something> ...)
.
(require-extension range)
The value of the delimited continuation ranges over the set of values specified by the state generation procedure suite. For use with (breset ...)
.
FROM |
Zero argument procedure, returning the initial state. |
VALUE |
Single argument procedure, of the state, returning the value of the state. |
STEP |
Single argument procedure, of the state, returning the next state. |
TO? |
Single argument procedure, of the state, returning |
The value of the delimited continuation ranges over the number interval [FROM TO], by STEP. The increment is 1 when missing. For use with (breset ...)
.
Version of (range ...)
for use with (%breset ...)
.
Version of (range ...)
for use with (%breset ...)
.
(require-extension reflect-reify)
Expands to (define (KIND-unit obj) BODY ...)
.
Expands to (define (KIND-bind monad func) BODY ...)
.
Extract value from MONAD. Plays the role of Haskell '<-'.
Extract value from MONAD. Plays the role of Haskell '<-'.
Extract value from MONAD. Plays the role of Haskell '<-'.
Return result of EXPRESSION as a monad.
Return result of EXPRESSION as a monad.
Return result of EXPRESSION as a monad.
(require-extension gshift-greset)
The generalized shift and reset operator family from How to remove a dynamic prompt: static and dynamic delimited continuation operators are equally expressible.
Reset parameterized by the H Reset procedure HR.
Shift parameterized by the H Shift procedure HS.
H Reset Stop.
H Shift Stop.
H Reset Propagate.
H Shift Propagate.
Returns the composition of F and X as an h-datatype.
Returns the value of V as an h-datatype.
Is OBJECT an h-datatype?
Deconstructs the h-datatype E, binding F & X for an evaluation of the ON-h-EXPR and V for an evaluation of the ON-V-EXPR.
Not a direct implementation of partial continuations. Simulated using full continuations.
;; ;; See "F-operator-test.scm" in the unpacked egg for more examples. ;;
Copyright (c) 2006, Kon Lovett. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Does not supercede any restrictions found in the source code.