Changeset 33418 in project


Ignore:
Timestamp:
06/12/16 19:18:35 (3 years ago)
Author:
Kon Lovett
Message:

rel 3.0.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/F-operator

    r31303 r33418  
    1010The static delimited continuation operators shift and reset.
    1111
    12 Note: Procedures that are prefixed with a {{%}} may have better performance than their non {{%}} equivalents.
    13 
    1412=== Shift/Reset - Dynamically scoped shift/reset
    1513
     
    1917
    2018A "stuck on control" situation, a 'shift' without an enclosing 'reset', is an error.
    21 
    22 ==== %reset
    23 
    24 <macro>(%reset EXPRESSION ...)</macro>
    25 
    26 Evaluate the body {{EXPRESSION ...}} with a delimited continuation. The body
    27 will contain one or more instances of {{(%shift ...))
    28 
    29 Any use of {{(dynamic-wind ...)}} within the dynamic scope of the partial
    30 continuation will be '''ignored'''!
    31 
    32 ==== %shift
    33 
    34 <macro>(%shift PC-TAG EXPRESSION)</macro>
    35 
    36 Within the scope of {{EXPRESSION}} {{PC-TAG}} is bound to the reified partial
    37 continuation delimited by the enclosing {{(%reset ...)}}. Provide a value to the
    38 partial continuation using the form {{(PC-TAG <something>)}}.
    3919
    4020==== reset
     
    5333partial continuation using the form {{(PC-TAG <something>)}}.
    5434
    55 ==== %reset-values
    56 
    57 <macro>(%reset-values EXPRESSION ...)</macro>
    58 
    59 Multiple value return version of {{(%reset ...)}}. The body will contain one or
    60 more instances of {{(%shift-values ...)}}
    61 
    62 Any use of {{(dynamic-wind ...)}} within the dynamic scope of the partial
    63 continuation will be '''ignored'''!
    64 
    65 ==== %shift-values
    66 
    67 <macro>(%shift-values PC-TAG EXPRESSION)</macro>
    68 
    69 Multiple value return version of {{(%shift ...)}}. Provide a value to the
    70 partial continuation using the form {{(PC-TAG <something> ...)}}.
    71 
    7235==== reset-values
    7336
     
    9255Invalid delimited continuations, what {{RC-TAG}} below represents, and ''stuck
    9356on control'' will generate an error
    94 
    95 ==== %breset
    96 
    97 <macro>(%breset RC-TAG EXPRESSION ...)</macro>
    98 
    99 Evaluate the body {{EXPRESSION ...}} with a delimited continuation named
    100 {{RC-TAG}}. The body will contain one or more instances of {{(%bshift RC-TAG
    101 ...)}}
    102 
    103 Any use of {{(dynamic-wind ...)}} within the dynamic scope of the partial
    104 continuation will be '''ignored'''!
    105 
    106 ==== %bshift
    107 
    108 <macro>(%bshift RC-TAG PC-TAG EXPRESSION)</macro>
    109 
    110 Within the scope of {{EXPRESSION}} {{PC-TAG}} is bound to the reified partial
    111 continuation delimited by the enclosing {{(%breset RC-TAG ...)}}. Provide a
    112 value to the partial continuation using the form {{(PC-TAG <something>)}}.
    11357
    11458==== breset
     
    12872value to the partial continuation using the form {{(PC-TAG <something>)}}.
    12973
    130 ==== %breset-values
    131 
    132 <macro>(%breset-values RC-TAG EXPRESSION ...)</macro>
    133 
    134 Multiple value return version of {{(%breset ...)}}. The body will contain one or more instances of {{(%bshift-values RC-TAG ...)}}
    135 
    136 Any use of {{(dynamic-wind ...)}} within the dynamic scope of the partial
    137 continuation will be '''ignored'''!
    138 
    139 ==== %bshift-values
    140 
    141 <macro>(%bshift-values RC-TAG PC-TAG EXPRESSION)</macro>
    142 
    143 Multiple value return version of {{(%bshift ...)}}. Provide a value to the
    144 partial continuation using the form {{(PC-TAG <something> ...)}}.
    145 
    14674==== breset-values
    14775
     
    188116use with  {{(breset ...)}}.
    189117
    190 ==== %range
    191 
    192 <macro>(%range RC-TAG FROM VALUE STEP TO?)</macro>
    193 
    194 Version of {{(range ...)}} for use with {{(%breset ...)}}.
    195 
    196 ==== %range
    197 
    198 <macro>(%range RC-TAG FROM [STEP] TO)</macro>
    199 
    200 Version of {{(range ...)}} for use with {{(%breset ...)}}.
    201 
    202118=== Reflect/Reify - Monads
    203119
     
    206122</enscript>
    207123
     124The Monad example from Filinski, POPL '94
     125
    208126==== define-unit
    209127
     
    230148Extract value from {{MONAD}}. Plays the role of Haskell '<-'.
    231149
    232 ==== %reflect
    233 
    234 <macro>(%reflect KIND MONAD)</macro>
    235 
    236 Extract value from {{MONAD}}. Plays the role of Haskell '<-'.
    237 
    238150==== reify
    239151
     
    245157
    246158<macro>(reify-values KIND EXPRESSION)</macro>
    247 
    248 Return result of {{EXPRESSION}} as a monad.
    249 
    250 ==== %reify
    251 
    252 <macro>(%reify KIND EXPRESSION)</macro>
    253159
    254160Return result of {{EXPRESSION}} as a monad.
     
    352258== Notes
    353259
    354 * Not a direct implementation of partial continuations. Simulated using full continuations.
     260* Not a direct implementation of partial continuations. Simulated using full
     261continuations.
     262
     263* The {{reflect-reify}} module (Monads) is an example of the use of
     264{{shift}}/{{reset}}. Not a general purpose implementation for use in Scheme
     265monadic programming.
    355266
    356267
     
    363274== Bugs and Limitations
    364275
     276* The distinction between the single-valued return & multi-valued return
     277versions of the control operators, ex: {{shift}} & {{shift-values}}. The
     278current single-valued syntax should handle multi-value returns.
     279
    365280
    366281== Author
     
    371286== Version history
    372287
     288; 3.0.0 : Remove {{%reset}}, {{%shift}}, {{%reset-values}}, {{%shift-values}}, {{%breset}}, {{%bshift}}, {{%breset-values}}, {{%bshift-values}}, {{%range}}, {{%reflect}}, & {{%reify}}.
     289; 2.0.4 : Has argc-checks.
     290; 2.0.3 : Use {{er-macro-transformer}}.
     291; 2.0.2 : Has lambda-info.
    373292; 2.0.1 : Added miscmacros as a dependency [Ivan Raikov].
    374293; 2.0.0 : Initial Chicken 4 release.
Note: See TracChangeset for help on using the changeset viewer.