Changeset 8041 in project


Ignore:
Timestamp:
02/02/08 14:07:16 (12 years ago)
Author:
Ivan Raikov
Message:

Bug fix in cminus; replaced values/let-values with list/match-let.

Location:
random-swb/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • random-swb/trunk/random-swb-eggdoc.scm

    r7358 r8041  
    99
    1010     (history
     11      (version "1.6" "Bug fix in the cminus procedure; replaced values/let-values with list/let-match")
    1112      (version "1.5" "Bug fix in the setup file")
    1213      (version "1.4" "Removed easyffi dependency")
  • random-swb/trunk/random-swb.scm

    r6984 r8041  
    6868<#
    6969
    70 (define cminus (foreign-lambda int "cminus" int int int))
     70(define cminus (foreign-lambda unsigned-int "cminus" unsigned-int unsigned-int int))
    7171
    7272
     
    178178
    179179  (define (genseed n seeds congx shrgx)
    180     (if (zero? n) (values seeds congx)
     180    (if (zero? n) (list seeds congx)
    181181        (let ((v (mkseed congx shrgx)))
    182182          (match v  ((seed congx1 shrgx1)
     
    186186  (define congx (fx+ 1 (fxshl (bitwise-and congy max-word) 1)))
    187187
    188   (let-values (((seeds congx)  (genseed N (list) congx shrgx)))
     188  (match-let (((seeds congx)  (genseed N (list) congx shrgx)))
    189189    (make-swb-state (list->u32vector seeds) #f congx 0)))
    190190
     
    240240                       (i   (fill! s1))
    241241                       (v   (tweak s1 i)))
    242                   (values s1 v))
     242                  (list s1 v))
    243243                (let* ((s1 (make-swb-state seeds borrow congseed (fx+ 1 index)))
    244244                       (v  (tweak s1 (u32vector-ref seeds index))))
    245                   (values s1 v)))))
     245                  (list s1 v)))))
    246246         (else (swb:error 'swb:random "invalid state " s))))
    247247
    248248(define (swb:random-natural s)
    249   (let-values (((s v) (swb:random s)))
    250     (values s (bitwise-and v lo29))))
     249  (match-let (((s v) (swb:random s)))
     250             (list s (bitwise-and v lo29))))
    251251
    252252(define (swb:random-real s)
    253   (let-values (((s1 n1) (swb:random-natural s)))
    254     (let-values (((s2 n2) (swb:random-natural s1)))
    255        (values s2 (* 2^-29 (+ n1 (* n2 2^-29)))))))
     253  (match-let (((s1 n1) (swb:random-natural s)))
     254    (match-let (((s2 n2) (swb:random-natural s1)))
     255       (list s2 (* 2^-29 (+ n1 (* n2 2^-29)))))))
    256256
    257257(define (swb:random-range i j)
     
    261261          (let ((R  (* 2^-29 (fx+ 1 (fx- j i)))))
    262262            (lambda (s)
    263               (let-values (((s1 v) (swb:random-natural s)))
    264                 (values s1 (fx+ i (inexact->exact (truncate (* R v))))))))
     263              (match-let (((s1 v) (swb:random-natural s)))
     264                (list s1 (fx+ i (inexact->exact (truncate (* R v))))))))
    265265          (let ((R  (fx+ 1 (fx- j i))))
    266266            (lambda (s)
    267               (let-values (((s1 v)  (swb:random-real s)))
    268                   (values s1 (+ i (* R v)))))))))
    269          
    270          
     267              (match-let (((s1 v)  (swb:random-real s)))
     268                  (list s1 (+ i (* R v)))))))))
     269         
     270         
  • random-swb/trunk/random-swb.setup

    r7009 r8041  
    2121
    2222  ; Assoc list with properties for your extension:
    23   '((version 1.5)
     23  '((version 1.6)
    2424    (documentation "random-swb.html")
    2525    ,@(if has-exports? `((exports "random-swb.exports")) (list)) ))
Note: See TracChangeset for help on using the changeset viewer.