Changeset 33848 in project for release/4/srfi-27/trunk/srfi-27.scm


Ignore:
Timestamp:
02/11/17 16:41:38 (3 years ago)
Author:
Kon Lovett
Message:

re-flow, add "catalog" supp

File:
1 edited

Legend:

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

    r19077 r33848  
    7575(define-parameter current-entropy-source default-entropy-source
    7676  (lambda (x)
    77     (cond ((entropy-source? x) x)
    78           (else
    79             (warning-argument-type 'current-entropy-source x 'entropy-source)
    80             (current-entropy-source) ) ) ) )
    81 
     77    (cond
     78      ((entropy-source? x)
     79        x)
     80      (else
     81        (warning-argument-type 'current-entropy-source x 'entropy-source)
     82        (current-entropy-source) ) ) ) )
     83
     84(define make-entropy-source
     85  (case-lambda
     86    (()
     87      ((@entropy-source-constructor (current-entropy-source))) )
     88    ((es)
     89      (let ((ctor
     90              (cond
     91                ((entropy-source? es)
     92                  (@entropy-source-constructor es) )
     93                ((symbol? es)
     94                  (let ((ctor (registered-entropy-source es)))
     95                    (or
     96                      ctor
     97                      (error 'make-entropy-source "unregistered entropy-source name" es) ) ) )
     98                (else
     99                  (error-argument-type
     100                    'make-entropy-source es
     101                    "valid entropy-source or registered entropy-source name") ) ) ) )
     102        (ctor) ) ) ) )
     103
     104#;
    82105(define (make-entropy-source #!optional (es (current-entropy-source)))
    83106  (let ((ctor
    84107          (cond
    85             ((entropy-source? es) (@entropy-source-construtor es) )
    86             ((symbol? es)         (registered-entropy-source es) )
     108            ((entropy-source? es)
     109              (@entropy-source-constructor es) )
     110            ((symbol? es)
     111              (registered-entropy-source es) )
    87112            (else
    88113              (error-argument-type
     
    93118(define (new-entropy-source es)
    94119  (check-entropy-source 'new-entropy-source es)
    95   ((@entropy-source-construtor es)) )
     120  ((@entropy-source-constructor es)) )
    96121
    97122(define (entropy-source-name es)
     
    131156    (lambda (n)
    132157      (check-cardinal-integer 'make-u8vector n 'length)
    133       (u8vector-filled! (make-u8vector n) (lambda () (modulo (rndint) 256))) ) ) )
     158      (u8vector-filled! (make-u8vector n) (lambda () (rndint 256))) ) ) )
    134159
    135160(define (*random-source-make-f64vectors rs prec)
     
    159184(define-parameter current-random-source default-random-source
    160185  (lambda (x)
    161     (cond ((random-source? x) x)
    162           (else
    163             (warning-argument-type 'current-random-source x 'random-source)
    164             (current-random-source) ) ) ) )
    165 
     186    (cond
     187      ((random-source? x)
     188        x)
     189      (else
     190        (warning-argument-type 'current-random-source x 'random-source)
     191        (current-random-source) ) ) ) )
     192
     193(define make-random-source
     194  (case-lambda
     195    (()
     196      ((@random-source-constructor (current-random-source))) )
     197    ((es)
     198      (let ((ctor
     199              (cond
     200                ((random-source? es)
     201                  (@random-source-constructor es) )
     202                ((symbol? es)
     203                  (registered-random-source es) )
     204                (else
     205                  (error-argument-type
     206                    'make-random-source es
     207                    "valid random-source or registered random-source name") ) ) ) )
     208        (ctor) ) ) ) )
     209
     210#;
    166211(define (make-random-source #!optional (es (current-random-source)))
    167212  (let ((ctor
    168213          (cond
    169             ((random-source? es)  (@random-source-construtor es) )
    170             ((symbol? es)         (registered-random-source es) )
     214            ((random-source? es)
     215              (@random-source-constructor es) )
     216            ((symbol? es)
     217              (registered-random-source es) )
    171218            (else
    172219              (error-argument-type
     
    177224(define (new-random-source es)
    178225  (check-random-source 'new-random-source es)
    179   ((@random-source-construtor es)) )
     226  ((@random-source-constructor es)) )
    180227
    181228(define (random-source-name rs)
Note: See TracChangeset for help on using the changeset viewer.