Changeset 35572 in project


Ignore:
Timestamp:
06/09/18 23:23:56 (2 weeks ago)
Author:
kon
Message:

don't use typed-define here

Location:
release/4/amb/trunk
Files:
4 edited

Legend:

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

    r35142 r35572  
    2424  (only data-structures sort! constantly)
    2525  (only (srfi 1) count every)
    26   amb
    27   typed-define)
     26  amb)
    2827
    2928;;;
     
    8382;;
    8483
    85 (define: (count-member (x *) (xs (list-of *)) . (opts (list procedure))) --> fixnum
     84(: count-member (* (list-of *) #!rest (list procedure) --> fixnum))
     85;
     86(define (count-member x xs . opts)
    8687  (let ((eql? (optional opts equal?)))
    8788    (count (cut eql? x <>) xs) ) )
    8889
    89 (define: (only-member? (x *) (xs (list-of *)) . (opts (list procedure))) --> boolean
     90(: only-member? (* (list-of *) #!rest (list procedure) --> boolean))
     91;
     92(define (only-member? x xs . opts)
    9093  (let ((eql? (optional opts equal?)))
    9194    (= 1 (count-member x xs eql?)) ) )
     
    9396;;
    9497
    95 (define: (list-constantly (ls list)) --> (list-of procedure)
     98(: list-constantly (list --> (list-of procedure)))
     99;
     100(define (list-constantly ls)
    96101  (map constantly ls) )
    97102
    98103;;
    99104
    100 (define: (distinct? (xs (list-of *)) . (opts (list procedure))) --> boolean
     105(: distinct? ((list-of *) #!rest (list procedure) --> boolean))
     106;
     107(define (distinct? xs . opts)
    101108  (let ((eql? (optional opts equal?)))
    102109    (every (cut only-member? <> xs eql?) xs) ) )
  • release/4/amb/trunk/amb.meta

    r35151 r35572  
    1111        (miscmacros "2.91")
    1212        (check-errors "1.12.0")
    13         (condition-utils "1.0.0")
    14         (dsssl-utils "2.2.0"))
     13        (condition-utils "1.0.0")))
    1514 (test-depends test)
    1615 (files
  • 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
  • release/4/amb/trunk/amb.setup

    r34337 r35572  
    55(verify-extension-name "amb")
    66
    7 (setup-shared+static-extension-module 'amb (extension-version "2.3.0")
    8   #:inline? #t
     7(setup-shared+static-extension-module 'amb (extension-version "2.3.1")
     8  ;#:inline? #t
    99  #:types? #t
    10   #:compile-options '(-fixnum-arithmetic -O3 -d1 -no-procedure-checks)
     10  #:compile-options '(-O3 -d1 -no-procedure-checks)
    1111  #:install-options '((examples "amb-dwelling.scm" "amb-kalotan.scm" "amb-money.scm")))
    1212
    13 (setup-shared+static-extension-module 'amb-extras (extension-version "2.3.0")
    14   #:inline? #t
     13(setup-shared+static-extension-module 'amb-extras (extension-version "2.3.1")
     14  ;#:inline? #t
    1515  #:types? #t
    16   #:compile-options '(-fixnum-arithmetic -O3 -d1 -no-procedure-checks))
     16  #:compile-options '(-O3 -d1 -no-procedure-checks))
Note: See TracChangeset for help on using the changeset viewer.