Changeset 37251 in project


Ignore:
Timestamp:
02/16/19 03:38:05 (3 months ago)
Author:
kon
Message:

fix random procedure types

Location:
release/4/srfi-27
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/4/srfi-27/OO-example.scm

    r35514 r37251  
    55;; Named (has a name) "concept"
    66(define-generic (name obj))
    7 (define-class <named> () (
    8   (namsym reader: name) ) )
    9 (define-method (name (obj <named>))
    10   (slot-value obj 'namsym))
     7(define-class <named> () ((namsym reader: name)))
     8(define-method (name (obj <named>)) (slot-value obj 'namsym))
    119
    1210;; Parameterized extension "concept"
     
    1614(define-generic (next-value obj))
    1715(define-class <stepper> () (nxtval))
    18 (define-method (next-value (obj <stepper>))
    19   ((slot-value obj 'nxtval)))
     16(define-method (next-value (obj <stepper>)) ((slot-value obj 'nxtval)))
    2017(define-generic (reset obj))
    2118(define-method (reset (obj <stepper>))
    2219  (let-values (
    23       ((gen _)
    24         (apply
    25           (slot-value obj 'ctor)
    26           `(,@(slot-value obj 'params) ,(slot-value obj 'src))) ) )
     20    ((gen _)
     21      (apply
     22        (slot-value obj 'ctor)
     23        `(,@(slot-value obj 'params) ,(slot-value obj 'src)))) )
    2724    (set! (slot-value obj 'nxtval) gen) ) )
    2825
     
    3936(define-syntax make-random-distribution
    4037  (syntax-rules ()
    41     ((_ ?ctor ?arg0 ...)
     38    ((make-random-distribution ?ctor ?arg0 ...)
    4239      ;use tmpval to hold the ctor call form
    4340      (make <random-distribution> 'tmpval (list ?ctor ?arg0 ...)) ) ) )
     
    5249  ; (I do not endorse this kind of "auto-magic". For example only.)
    5350  (let* (
    54       (tmpval
    55         (or
    56           (slot-value obj 'tmpval)
    57           `(,make-random-normals)) )
    58       (ctor
    59         (car tmpval) )
    60       (procinfo
    61         (procedure-information ctor) )
    62       (procname
    63         (and procinfo (pair? procinfo) (symbol->string (car procinfo))))
    64       (procname
    65         (and
    66           procname
    67           (and-let* ((kndpos (string-index-right procname #\-)))
    68             (substring/shared procname (add1 kndpos)) ) ) )
    69       (procname (or procname "impossible"))
    70       (dstr-vals
    71         (receive (apply ctor (cdr tmpval))) )
    72       (params
    73         (and
    74           (<= 2 (length dstr-vals))
    75           (receive ((second dstr-vals)))) ) )
     51    (tmpval
     52      (or
     53        (slot-value obj 'tmpval)
     54        `(,make-random-normals)) )
     55    (ctor
     56      (car tmpval) )
     57    (procinfo
     58      (procedure-information ctor) )
     59    (procname
     60      (and procinfo (pair? procinfo) (symbol->string (car procinfo))))
     61    (procname
     62      (and
     63        procname
     64        (and-let* ((kndpos (string-index-right procname #\-)))
     65          (substring/shared procname (add1 kndpos)) ) ) )
     66    (procname (or procname "impossible"))
     67    (dstr-vals
     68      (receive (apply ctor (cdr tmpval))) )
     69    (params
     70      (and
     71        (<= 2 (length dstr-vals))
     72        (receive ((second dstr-vals)))) ) )
    7673    ;"free" the temp slot
    7774    (set! (slot-value obj 'tmpval) #f)
  • release/4/srfi-27/trunk/srfi-27-common-types.scm

    r35490 r37251  
    3535(define-type random-source-state list)
    3636
    37 (define-type boolean-function (--> boolean))
     37(define-type boolean-function (-> boolean))
    3838
    39 (define-type number-function (--> number))
     39(define-type number-function (-> number))
    4040
    41 (define-type random-integer-function (number --> number))
     41(define-type random-integer-function (number -> number))
    4242
    43 (define-type random-f64-function  (--> float))
     43(define-type random-f64-function  (-> float))
    4444
    4545;fortran "real"
    4646(define-type random-real-function random-f64-function)
    4747
    48 (define-type random-u8-function  (--> fixnum))
     48(define-type random-u8-function  (-> fixnum))
    4949
    50 (define-type random-u8vector-function (fixnum --> u8vector))
     50(define-type random-u8vector-function (fixnum -> u8vector))
    5151
    52 (define-type random-f64vector-function (fixnum --> f64vector))
     52(define-type random-f64vector-function (fixnum -> f64vector))
    5353
    5454(define-type random-source-entropy-source (or boolean entropy-source))
     
    6060(define-type srfi-27-vector (or vector f32vector f64vector))
    6161
    62 (define-type random-vector-function (fixnum --> vector))
     62(define-type random-vector-function (fixnum -> vector))
  • release/4/srfi-27/trunk/srfi-27-uniform-random.scm

    r35477 r37251  
    5757              (+ low (* (rndint rng) prec) ) ) ) ) ) ) ) )
    5858
     59;;;
     60
     61(: make-pseudo-random-integer (#!rest --> number-function procedure))
     62;
     63(define (make-pseudo-random-integer #!key (source (current-random-source)))
     64  (check-random-source 'make-pseudo-random-integer source 'source)
     65  (values
     66    ((@random-source-make-integers source))
     67    (lambda ()
     68      (values source)) ) )
     69
    5970(: make-uniform-random-integers (#!rest --> number-function procedure))
    6071;
  • release/4/srfi-27/trunk/srfi-27.setup

    r35514 r37251  
    1717  -no-procedure-checks-for-toplevel-bindings))
    1818
    19 (setup-shared-extension-module 'source-registration (extension-version "3.4.1")
     19(setup-shared-extension-module 'source-registration (extension-version "3.4.2")
    2020  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    2121
    22 (setup-shared-extension-module 'srfi-27-numbers (extension-version "3.4.1")
     22(setup-shared-extension-module 'srfi-27-numbers (extension-version "3.4.2")
    2323  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    2424
    25 (setup-shared-extension-module 'srfi-27-vector-support (extension-version "3.4.1")
     25(setup-shared-extension-module 'srfi-27-vector-support (extension-version "3.4.2")
    2626  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    2727
    2828;; Entropy Source Modules
    2929
    30 (setup-shared-extension-module 'entropy-source (extension-version "3.4.1")
     30(setup-shared-extension-module 'entropy-source (extension-version "3.4.2")
    3131  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    3232
    33 (setup-shared-extension-module 'entropy-support (extension-version "3.4.1")
     33(setup-shared-extension-module 'entropy-support (extension-version "3.4.2")
    3434  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    3535
    36 (setup-shared-extension-module 'entropy-clock (extension-version "3.4.1")
     36(setup-shared-extension-module 'entropy-clock (extension-version "3.4.2")
    3737  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    3838
    39 (setup-shared-extension-module 'entropy-procedure (extension-version "3.4.1")
     39(setup-shared-extension-module 'entropy-procedure (extension-version "3.4.2")
    4040  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    4141
    42 (setup-shared-extension-module 'entropy-port (extension-version "3.4.1")
     42(setup-shared-extension-module 'entropy-port (extension-version "3.4.2")
    4343  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    4444
    4545#+unix
    46 (setup-shared-extension-module 'entropy-unix (extension-version "3.4.1")
     46(setup-shared-extension-module 'entropy-unix (extension-version "3.4.2")
    4747  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    4848
    4949#|
    5050#+linux
    51 (setup-shared-extension-module 'entropy-linux (extension-version "3.4.1")
     51(setup-shared-extension-module 'entropy-linux (extension-version "3.4.2")
    5252  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    5353|#
    5454
    5555#+windows
    56 (setup-shared-extension-module 'entropy-windows (extension-version "3.4.1")
     56(setup-shared-extension-module 'entropy-windows (extension-version "3.4.2")
    5757  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    5858
     
    6060
    6161#; ;WIP
    62 (setup-shared-extension-module 'well512 (extension-version "3.4.1")
     62(setup-shared-extension-module 'well512 (extension-version "3.4.2")
    6363  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    6464
    65 (setup-shared-extension-module 'random-source (extension-version "3.4.1")
     65(setup-shared-extension-module 'random-source (extension-version "3.4.2")
    6666  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    6767
    6868;-c++ w/ crunch
    69 (setup-shared-extension-module 'mrg32k3a (extension-version "3.4.1")
     69(setup-shared-extension-module 'mrg32k3a (extension-version "3.4.2")
    7070  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    7171
    72 (setup-shared-extension-module 'mwc (extension-version "3.4.1")
     72(setup-shared-extension-module 'mwc (extension-version "3.4.2")
    7373  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    7474
    75 (setup-shared-extension-module 'moa (extension-version "3.4.1")
     75(setup-shared-extension-module 'moa (extension-version "3.4.2")
    7676  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    7777
    7878#;
    79 (setup-shared-extension-module 'bsdrnd (extension-version "3.4.1")
     79(setup-shared-extension-module 'bsdrnd (extension-version "3.4.2")
    8080  #:inline? #t #:types? #t #:compile-options UTILITY-OPTIONS)
    8181
    8282;; Main Modules
    8383
    84 (setup-shared-extension-module 'srfi-27 (extension-version "3.4.1")
     84(setup-shared-extension-module 'srfi-27 (extension-version "3.4.2")
    8585  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    8686
    87 (setup-shared-extension-module 'srfi-27-uniform-random (extension-version "3.4.1")
     87(setup-shared-extension-module 'srfi-27-uniform-random (extension-version "3.4.2")
    8888  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    8989
    90 (setup-shared-extension-module 'srfi-27-distributions-support (extension-version "3.4.1")
     90(setup-shared-extension-module 'srfi-27-distributions-support (extension-version "3.4.2")
    9191  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    9292
    93 (setup-shared-extension-module 'srfi-27-bernoullis (extension-version "3.4.1")
     93(setup-shared-extension-module 'srfi-27-bernoullis (extension-version "3.4.2")
    9494  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    9595
    96 (setup-shared-extension-module 'srfi-27-binomials (extension-version "3.4.1")
     96(setup-shared-extension-module 'srfi-27-binomials (extension-version "3.4.2")
    9797  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    9898
    99 (setup-shared-extension-module 'srfi-27-cauchys (extension-version "3.4.1")
     99(setup-shared-extension-module 'srfi-27-cauchys (extension-version "3.4.2")
    100100  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    101101
    102 (setup-shared-extension-module 'srfi-27-normals (extension-version "3.4.1")
     102(setup-shared-extension-module 'srfi-27-normals (extension-version "3.4.2")
    103103  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    104104
    105105;needs normals
    106 (setup-shared-extension-module 'srfi-27-gammas (extension-version "3.4.1")
     106(setup-shared-extension-module 'srfi-27-gammas (extension-version "3.4.2")
    107107  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    108108
    109109;needs gammas
    110 (setup-shared-extension-module 'srfi-27-erlangs (extension-version "3.4.1")
     110(setup-shared-extension-module 'srfi-27-erlangs (extension-version "3.4.2")
    111111  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    112112
    113 (setup-shared-extension-module 'srfi-27-exponentials (extension-version "3.4.1")
     113(setup-shared-extension-module 'srfi-27-exponentials (extension-version "3.4.2")
    114114  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    115115
    116 (setup-shared-extension-module 'srfi-27-geometrics (extension-version "3.4.1")
     116(setup-shared-extension-module 'srfi-27-geometrics (extension-version "3.4.2")
    117117  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    118118
    119 (setup-shared-extension-module 'srfi-27-levys (extension-version "3.4.1")
     119(setup-shared-extension-module 'srfi-27-levys (extension-version "3.4.2")
    120120  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    121121
    122 (setup-shared-extension-module 'srfi-27-lognormals (extension-version "3.4.1")
     122(setup-shared-extension-module 'srfi-27-lognormals (extension-version "3.4.2")
    123123  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    124124
    125125;needs gammas exponentials
    126 (setup-shared-extension-module 'srfi-27-paretos (extension-version "3.4.1")
     126(setup-shared-extension-module 'srfi-27-paretos (extension-version "3.4.2")
    127127  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    128128
    129 (setup-shared-extension-module 'srfi-27-poissons (extension-version "3.4.1")
     129(setup-shared-extension-module 'srfi-27-poissons (extension-version "3.4.2")
    130130  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    131131
    132 (setup-shared-extension-module 'srfi-27-triangles (extension-version "3.4.1")
     132(setup-shared-extension-module 'srfi-27-triangles (extension-version "3.4.2")
    133133  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    134134
    135 (setup-shared-extension-module 'srfi-27-weibulls (extension-version "3.4.1")
     135(setup-shared-extension-module 'srfi-27-weibulls (extension-version "3.4.2")
    136136  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    137137
    138 (setup-shared-extension-module 'srfi-27-distributions (extension-version "3.4.1")
     138(setup-shared-extension-module 'srfi-27-distributions (extension-version "3.4.2")
    139139  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    140140
    141 (setup-shared-extension-module 'srfi-27-vector (extension-version "3.4.1")
     141(setup-shared-extension-module 'srfi-27-vector (extension-version "3.4.2")
    142142  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    143143
    144144;; Composite Source Modules
    145145
    146 (setup-shared-extension-module 'composite-entropy-source (extension-version "3.4.1")
     146(setup-shared-extension-module 'composite-entropy-source (extension-version "3.4.2")
    147147  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
    148148
    149 (setup-shared-extension-module 'composite-random-source (extension-version "3.4.1")
     149(setup-shared-extension-module 'composite-random-source (extension-version "3.4.2")
    150150  #:inline? #t #:types? #t #:compile-options PUBLIC-OPTIONS)
Note: See TracChangeset for help on using the changeset viewer.