Changeset 35572 in project for release/4/amb/trunk/amb.scm


Ignore:
Timestamp:
06/09/18 23:23:56 (4 months ago)
Author:
kon
Message:

don't use typed-define here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/amb/trunk/amb.scm

    r35142 r35572  
    2929  (only miscmacros let/cc define-parameter)
    3030  (only type-errors warning-argument-type)
    31   (only condition-utils make-exn-condition+)
    32   typed-define)
     31  (only condition-utils make-exn-condition+))
    3332
    3433;;;
     
    105104;;
    106105
    107 (define: (amb-thunks (thunks (list-of procedure))) -> *
     106(: amb-thunks ((list-of procedure) -> *))
     107;
     108(define (amb-thunks thunks)
    108109  (let ((afc (amb-failure-continuation)))
    109110    (let/cc return
     
    117118            (return ((car tt))) ) ) ) ) ) )
    118119
    119 (define: (amb-thunks-shuffled (thunks (list-of procedure)) . (opts (list procedure))) -> *
     120(: amb-thunks-shuffled ((list-of procedure) #!rest (list procedure) -> *))
     121;
     122(define (amb-thunks-shuffled thunks . opts)
    120123  (let ((rand (optional opts (amb-random-function))))
    121124    (amb-thunks (shuffle thunks rand)) ) )
    122125
    123 (define: (amb-find-thunk (thunk procedure) . (opts (list procedure))) -> *
     126(: amb-find-thunk (procedure #!rest (list procedure) -> *))
     127;
     128(define (amb-find-thunk thunk . opts)
    124129  (let ((failure (optional opts amb-exhausted)))
    125130    (let/cc return
     
    128133          (thunk) ) ) ) ) )
    129134
    130 (define: (amb-collect-thunk (thunk procedure)) -> *
     135(: amb-collect-thunk (procedure -> *))
     136;
     137(define (amb-collect-thunk thunk)
    131138  (let ((afc #f))
    132139    (dynamic-wind
     
    151158;;;
    152159
    153 (define: (shuffle (ls (list-of *)) (random procedure)) -> (list-of *)
    154   ;
    155   (define (car< x y)
    156   (fx< (car x) (car y)) )
    157   ;
     160(: shuffle ((list-of *) procedure -> (list-of *)))
     161;
     162(define (shuffle ls random)
    158163  (let* (
    159164    (len (length ls))
    160165    (tagged-ls (map (lambda (x) (cons (random len) x)) ls)) )
    161     ;
    162     (map! cdr (sort! tagged-ls car<) ) ) )
     166    (map! cdr (sort! tagged-ls (lambda (a b) (fx< (car a) (car b)))) ) ) )
    163167
    164168) ;module amb
Note: See TracChangeset for help on using the changeset viewer.