Hello Zack,

"Zack Weinberg" <z...@owlfolio.org> writes:

> primes.scm appears never to have been updated for the new bitvector API
> (in Guile 3?), causing both build and test failures.

> The appended patch (vs 0.2.8.1) fixes the failures I am seeing.
> Assuming this is indeed an API change in Guile 3, I do not know what it
> would take to make this code work with both, and I ask that you take it
> from here.
>
> zw
>
> --- a/src/math/primes.scm     2024-05-23 19:26:16.757865343 -0400
> +++ b/src/math/primes.scm     2024-05-23 19:28:20.797358650 -0400
> @@ -114,7 +114,7 @@
>                     (set! prime:prime-sqr (* nexp nexp))
>                     (set! prime:sieve (make-bitvector nexp #f))
>                     (for-each (lambda (prime)
> -                               (bitvector-set! prime:sieve prime #t))
> +                               (bitvector-set-bit! prime:sieve prime))
>                               primes)
>                     (set! prime:products (reverse (cons comp comps))))
>                    (else
> @@ -132,7 +132,7 @@
>  There is a slight chance, @code{(expt 2 (- prime:trials))}, that a 
>  composite will return @code{#t}."
>    (set! n (abs n))
> -  (cond ((< n (bitvector-length prime:sieve)) (bitvector-ref prime:sieve n))
> +  (cond ((< n (bitvector-length prime:sieve)) (bitvector-bit-set? 
> prime:sieve n))

Just to make sure, you are seeing these failures using Guile 2, right?
With Guile 3.0.9, this test suite passes 'make check':

--8<---------------cut here---------------start------------->8---
PASS: math.primes.scm
--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim

Reply via email to