Changeset 34139 in project


Ignore:
Timestamp:
05/30/17 22:56:08 (5 months ago)
Author:
kon
Message:

rel 2.2.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/amb

    r34108 r34139  
    1515
    1616Installs the ''amb'' and ''amb-extras'' extensions.
     17
     18=== amb-random-function
     19
     20<procedure>(amb-random-function) => procedure</procedure>
     21<procedure>(amb-random-function RAND)</procedure>
     22
     23The random function {{paramerter}}. Default is ''extras' unit {{random}}.
     24
     25=== amb-failure-continuation
     26
     27<procedure>(amb-failure-continuation) => STATUS-VARIABLE</procedure>
     28<procedure>(amb-failure-continuation STATUS-VARIABLE)</procedure>
     29
     30Seen in a global context, the {{amb}} operator transforms the whole program
     31that contains it into a depth first search for return values from {{amb}} forms
     32that will not cause failure.
     33
     34This is realized using a backtracking system that invokes previously stored
     35continuations whenever an {{amb}} expression fails. The
     36{{amb-failure-continuation}} parameter is the status variable for this system.
     37
     38At the start of the program, or when no further backtracking options are
     39available, this is set to a procedure of no arguments that raises an exception
     40condition {{(exn amb)}} (except when a {{amb-collect}} statement is being
     41processed, where the parameter will point to a procedure signalling
     42{{amb-collect}} that there are no more backtracking options available).
     43
     44In all other cases this parameter is set to a procedure of no arguments that
     45causes backtracking to the next possible alternative in the ''tree''.
     46
     47If you want to restrict the scope of backtracking to something smaller than the
     48whole past program, use {{amb-find}} or {{amb-collect}} which restore this
     49parameter to its original value when they are done evaluating the expressions
     50they were given.
    1751
    1852=== amb
     
    6296Evaluates {{OK?}} and fails if it is {{#f}}.
    6397
    64 === amb-failure-continuation
    65 
    66 <procedure>(amb-failure-continuation) => STATUS-VARIABLE</procedure>
    67 <procedure>(amb-failure-continuation STATUS-VARIABLE)</procedure>
    68 
    69 Seen in a global context, the {{amb}} operator transforms the whole program
    70 that contains it into a depth first search for return values from {{amb}} forms
    71 that will not cause failure.
    72 
    73 This is realized using a backtracking system that invokes previously stored
    74 continuations whenever an {{amb}} expression fails. The
    75 {{amb-failure-continuation}} parameter is the status variable for this system.
    76 
    77 At the start of the program, or when no further backtracking options are
    78 available, this is set to a procedure of no arguments that raises an exception
    79 condition {{(exn amb)}} (except when a {{amb-collect}} statement is being
    80 processed, where the parameter will point to a procedure signalling
    81 {{amb-collect}} that there are no more backtracking options available).
    82 
    83 In all other cases this parameter is set to a procedure of no arguments that
    84 causes backtracking to the next possible alternative in the ''tree''.
    85 
    86 If you want to restrict the scope of backtracking to something smaller than the
    87 whole past program, use {{amb-find}} or {{amb-collect}} which restore this
    88 parameter to its original value when they are done evaluating the expressions
    89 they were given.
    90 
    9198=== amb-thunks
    9299
     
    98105this procedure, {{amb/random}} shuffles the list first.
    99106
     107=== amb-thunks-shuffled
     108
     109<procedure>(amb-thunks-shuffled THUNKS) => TOP</procedure>
     110
     111As {{amb-thunks}} after {{(shuffle THUNKS
     112
    100113=== amb-find-thunk
    101114
     
    119132=== Extension ''amb-extras''
    120133
     134=== amb1
     135
     136<macro>(amb1 LIST) => TOP</macro>
     137
     138{{amb}} but with a single list argument.
     139
    121140=== choose
    122141
     
    147166<procedure>(distinct? LIST [=? equal?]) => boolean</procedure>
    148167
    149 Is {{LIST}} a list of distinct elements, as determined by {{=?}}?
     168Is, using {{=?}} for comparison, {{LIST}} a {{list}} of distinct elements?
     169
     170=== count-member
     171
     172<procedure>(count-member OBJECT LIST [=? equal?]) => integer</procedure>
     173
     174Returns, using {{=?}} for comparison, the number of times {{OBJECT}}
     175referenced in {{LIST}}.
    150176
    151177
     
    226252
    227253[[check-errors|check-errors]]
     254[[miscmacros|miscmacros]]
     255[[condition-utils|condition-utils]]
     256
     257[[setup-helper|setup-helper]]
    228258
    229259
     
    231261
    232262[[/users/thomas-chust|Thomas Chust]]
     263[[/users/kon-lovett|Kon Lovett]]
    233264
    234265
    235266== Version history
    236267
     268; 2.2.0 : Add {{amb-thunks-shuffled}} & {{count-member}}.
    237269; 2.1.7 : Use test.
    238 ; 2.1.0 : Use of "check-errors" extension. [[/users/kon-lovett|Kon Lovett]]
     270; 2.1.0 : Use of "check-errors" extension.
    239271; 2.0.0 : Chicken 4 release. [[/users/kon-lovett|Kon Lovett]]
    240272
Note: See TracChangeset for help on using the changeset viewer.