Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
[[tags: egg]] == F-operator [[toc:]] == Documentation Delimited continuation operators. === Shift/Reset - Dynamically scoped shift/reset <enscript language=scheme> (import shift-reset) </enscript> A "stuck on control" situation, a 'shift' without an enclosing 'reset', is an error. ==== reset <syntax>(reset EXPRESSION ...)</syntax> Multiple value return version of {{(reset ...)}}. The body will contain one or more instances of {{(shift ...)}}. ==== shift <syntax>(shift PC-TAG EXPRESSION)</syntax> Multiple value return version of {{(shift ...)}}. Provide a value to the partial continuation using the form {{(PC-TAG <something> ...)}}. === BShift/BReset - Statically scoped shift/reset <enscript language=scheme> (import bshift-breset) </enscript> Invalid delimited continuations, what {{RC-TAG}} below represents, and ''stuck on control'' will generate an error ==== breset <syntax>(breset RC-TAG EXPRESSION ...)</syntax> Multiple value return version of {{(breset ...)}}. The body will contain one or more instances of {{(bshift RC-TAG ...)}}. ==== bshift <syntax>(bshift RC-TAG PC-TAG EXPRESSION)</syntax> Multiple value return version of {{(bshift ...)}}. Provide a value to the partial continuation using the form {{(PC-TAG <something> ...)}}. === Range <enscript language=scheme> (import range) </enscript> ==== range <syntax>(range RC-TAG FROM VALUE STEP TO?)</syntax> The value of the delimited continuation {{RC-TAG}} 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 {{#t) when the range is complete ==== range <syntax>(range RC-TAG FROM [STEP] TO)</syntax> The value of the delimited continuation {{RC-TAG}} ranges over the number interval [{{FROM}} {{TO}}], by {{STEP}}. The increment is 1 when missing. For use with {{(breset ...)}}. === Delimited Control <enscript language=scheme> (import delimited-control) </enscript> Generalized shift/reset implementations of some control operators. Within the scope of {{EXPR}} {{PP}} is bound to the reified partial continuation delimited by the enclosing {{(prompt/prompt0/reset/reset0 ...)}}. Provide a value to the partial continuation using the form {{(PP <something>)}}. ==== prompt <syntax>(prompt EXPR)</syntax> ==== prompt0 <syntax>(prompt0 EXPR)</syntax> ==== reset <syntax>(reset EXPR)</syntax> ==== reset0 <syntax>(reset0 EXPR)</syntax> ==== control <syntax>(control PP EXPR)</syntax> ==== control-abort <syntax>(control-abort V)</syntax> ==== control0 <syntax>(control0 PP EXPR)</syntax> ==== shift <syntax>(shift PP EXPR)</syntax> ==== shift0 <syntax>(shift0 PP EXPR)</syntax> === Reflect/Reify - Monads <enscript language=scheme> (import reflect-reify) </enscript> The Monad example from Filinski, POPL '94 ==== define-unit <syntax>(define-unit KIND BODY ...)</syntax> Expands to {{(define (KIND-unit obj) BODY ...)}}. ==== define-bind <syntax>(define-bind KIND BODY ...)</syntax> Expands to {{(define (KIND-bind monad func) BODY ...)}}. ==== reflect <syntax>(reflect KIND MONAD)</syntax> Extract value from {{MONAD}}. Plays the role of Haskell '<-'. ==== reify <syntax>(reify KIND EXPRESSION)</syntax> Return result of {{EXPRESSION}} as a monad. === GShift/GReset - Generalized shift/reset <enscript language=scheme> (import gshift-greset) </enscript> The generalized shift and reset operator family from [[http://www.cs.indiana.edu/cgi-bin/techreports/TRNNN.cgi?trnum=TR611|How to remove a dynamic prompt: static and dynamic delimited continuation operators are equally expressible]] ==== greset <syntax>(greset HR E)</syntax> Reset parameterized by the H Reset procedure {{HR}}. ==== gshift <syntax>(gshift HS F E)</syntax> Shift parameterized by the H Shift procedure {{HS}}. ==== hr-stop <procedure>(hr-stop V)</procedure> H Reset Stop. ==== hs-stop <procedure>(hs-stop V)</procedure> H Shift Stop ==== hr-prop <procedure>(hr-prop V)</procedure> H Reset Propagate. ==== hs-prop <procedure>(hs-prop V)</procedure> H Shift Propagate. ==== h-compose <procedure>(h-compose F X)</procedure> Returns the composition of {{F}} and {{X}} as an {{h-datatype}}. ==== h-value <procedure>(h-value V)</procedure> Returns the value of {{V}} as an {{h-datatype}}. ==== h-datatype? <procedure>(h-datatype? OBJECT)</procedure> Is {{OBJECT}} an {{h-datatype}}? ==== h-cases <syntax>(h-cases E ((F X) ON-h-EXPR) (V ON-V-EXPR))</syntax> 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}}. == Notes * The {{reflect-reify}} module (Monads) is an example of the use of {{shift}}/{{reset}}. Not a general purpose implementation for use in Scheme monadic programming. == Requirements [[box]] [[datatype]] [[miscmacros]] [[test]] [[test-utils]] [[utf8]] [[srfi-1]] [[srfi-18]] == Bugs and Limitations * Not a direct implementation of partial continuations. Simulated using full continuations. As such will be prey to the issues elaborated by [[http://okmij.org/ftp/continuations/against-callcc.html#traps|"call/cc implements shift? A good question"]]. == Author [[/users/kon-lovett|Kon Lovett]] === Repository This egg is hosted on the CHICKEN Subversion repository: [[https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/F-operator|https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/F-operator]] If you want to check out the source code repository of this egg and you are not familiar with Subversion, see [[/egg-svn-checkout|this page]]. == Version history ; 4.1.3 : Bit faster & larger. ; 4.1.2 : Drop ''A Better API''. ; 4.1.1 : Some thread isolation. Multi-valued {{delimited-control}}. ; 4.1.0 : Added {{delimited-control}} module. ; 4.0.0 : CHICKEN 5 release. == License Copyright (C) 2009-2023 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.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 23 to 10?