[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Guile 1.9.2 problems with guile-lib

From: Barry Fishman
Subject: Re: GNU Guile 1.9.2 problems with guile-lib
Date: Wed, 16 Sep 2009 16:48:51 -0400
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> Hi,
> Andy Wingo <address@hidden> writes:
>> What is a #y vector? Does anyone know?
> No idea.  Where does it come from?
> Ludo’.

>From the error message it is a generalized vector, which no longer
exists.  What seems to be wanted is a bitvector.  There does not
seem to be a literal for a bitvector although its printed like:

Maybe something like:

diff --git a/src/math/primes.scm b/src/math/primes.scm
index 9873ae4..43745e9 100644
--- a/src/math/primes.scm
+++ b/src/math/primes.scm
@@ -103,7 +103,7 @@ being labelled prime) is @code{(expt 2 (- prime:trials))}."
         (or (null? lst) (and (= 1 (gcd n (car lst))) (mapf (cdr lst)))))))
 (define prime:prime-sqr 121)
 (define prime:products '(105))
-(define prime:sieve #y(0 0 1 1 0 1 0 1 0 0 0))
+(define prime:sieve (bitvector #f #f #t #t #f #t #f #t #f #f #f))
 (letrec ((lp (lambda (comp comps primes nexp)
               (cond ((< comp (quotient most-positive-fixnum nexp))
                      (let ((ncomp (* nexp comp)))
@@ -112,9 +112,9 @@ being labelled prime) is @code{(expt 2 (- prime:trials))}."
                            (next-prime nexp (cons ncomp comps)))))
                     ((< (quotient comp nexp) (* nexp nexp))
                      (set! prime:prime-sqr (* nexp nexp))
-                     (set! prime:sieve (make-uniform-vector nexp #\nul 0))
+                     (set! prime:sieve (make-bitvector nexp #f))
                      (for-each (lambda (prime)
-                                 (uniform-vector-set! prime:sieve prime 1))
+                                 (bitvector-set! prime:sieve prime #t))
                      (set! prime:products (reverse (cons comp comps))))
@@ -132,7 +132,7 @@ being labelled prime) is @code{(expt 2 (- prime:trials))}."
 There is a slight chance, @code{(expt 2 (- prime:trials))}, that a 
 composite will return @code{#t}."
   (set! n (abs n))
-  (cond ((< n (uniform-vector-length prime:sieve)) (positive? 
(uniform-vector-ref prime:sieve n)))
+  (cond ((< n (bitvector-length prime:sieve)) (bitvector-ref prime:sieve n))
        ((even? n) #f)
        ((primes-gcd? n prime:products) #f)
        ((< n prime:prime-sqr) #t)

There are still other issues with guile-lib with 4 of 25 tests failing.
I have been looking at them as a background task.
Barry Fishman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]