Changeset 39048 in project for wiki/eggref/5/amb


Ignore:
Timestamp:
09/21/20 06:15:37 (2 months ago)
Author:
Kon Lovett
Message:

rel 3.0.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/amb

    r36216 r39048  
    178178==== required
    179179
    180 <syntax>(required EXPRESSION)</syntax>
    181 
    182 {{amb-assert}} synonym.
     180<syntax>(required EXPRESSION ...)</syntax>
     181
     182Conjunction of {{(amb-assert EXPRESSION) ...}}.
    183183
    184184==== distinct?
     
    220220(define (solve-dwelling-puzzle)
    221221
    222   (let ((baker (amb 1 2 3 4 5))
    223         (cooper (amb 1 2 3 4 5))
     222  (let ((baker    (amb 1 2 3 4 5))
     223        (cooper   (amb 1 2 3 4 5))
    224224        (fletcher (amb 1 2 3 4 5))
    225         (miller (amb 1 2 3 4 5))
    226         (smith (amb 1 2 3 4 5)))
    227 
    228     ;; They live on different floors.
    229     (required (distinct? (list baker cooper fletcher miller smith)))
    230 
    231     ;; Baker does not live on the top floor.
    232     (required (not (= baker 5)))
    233 
    234     ;; Cooper does not live on the bottom floor.
    235     (required (not (= cooper 1)))
    236 
    237     ;; Fletcher does not live on either the top or the bottom floor.
    238     (required (not (= fletcher 5)))
    239     (required (not (= fletcher 1)))
    240 
    241     ;; Miller lives on a higher floor than does Cooper.
    242     (required (> miller cooper))
    243 
    244     ;; Smith does not live on a floor adjacent to Fletcher's.
    245     (required (not (= (abs (- smith fletcher)) 1)))
    246 
    247     ;; Fletcher does not live on a floor adjacent to Cooper's.
    248     (required (not (= (abs (- fletcher cooper)) 1)))
    249 
    250     `((baker ,baker) (cooper ,cooper) (fletcher ,fletcher) (miller ,miller) (smith ,smith))) )
     225        (miller   (amb 1 2 3 4 5))
     226        (smith    (amb 1 2 3 4 5)) )
     227
     228    (required
     229      ;
     230      ; They live on different floors.
     231      (distinct? (list baker cooper fletcher miller smith))
     232      ;
     233      ; Baker does not live on the top floor.
     234      (not (= baker 5))
     235      ;
     236      ; Cooper does not live on the bottom floor.
     237      (not (= cooper 1))
     238      ;
     239      ; Fletcher does not live on either the top or the bottom floor.
     240      (not (= fletcher 5))
     241      (not (= fletcher 1))
     242      ;
     243      ; Miller lives on a higher floor than does Cooper.
     244      (> miller cooper)
     245      ;
     246      ; Smith does not live on a floor adjacent to Fletcher's.
     247      (not (= (abs (- smith fletcher)) 1))
     248      ;
     249      ; Fletcher does not live on a floor adjacent to Cooper's.
     250      (not (= (abs (- fletcher cooper)) 1)) )
     251
     252    `((baker    ,baker)
     253      (cooper   ,cooper)
     254      (fletcher ,fletcher)
     255      (miller   ,miller)
     256      (smith    ,smith))) )
    251257
    252258(solve-dwelling-puzzle) ;=> ((baker 3) (cooper 2) (fletcher 4) (miller 5) (smith 1))
     
    263269== Requirements
    264270
    265 [[check-errors]]
    266 [[condition-utils]]
     271[[srfi-1]]
    267272
    268273
     
    275280== Version history
    276281
     282; 3.0.2 : Remove dependencies, add {{srfi-1}}.
     283; 3.0.1 : .
    277284; 3.0.0 : CHICKEN 5 release.
    278285; 2.3.0 : Add {{shuffle}} & {{list-constantly}}.
Note: See TracChangeset for help on using the changeset viewer.