Sample implementation of make-ball-generator seems incorrect Bradley Lucier (03 Feb 2024 06:28 UTC)
Re: Sample implementation of make-ball-generator seems incorrect Arthur A. Gleckler (05 Feb 2024 00:47 UTC)

Sample implementation of make-ball-generator seems incorrect Bradley Lucier 03 Feb 2024 06:28 UTC
I wrote the included test program that does the following:

1.  Creates a generator for an elliptical "ball" with semi-axes 10 and 2.
2.  Generates 100,000 points in the ellipse.
3.  Checks that (9.5, 0.5) is in the ellipse.
4.  Filters the points in two equal area regions within the ellipse,
     $(-0.5, 0.5)\times(-0.5, 0.5)$ and $(8.5, 9.5)\times(-0.5, 0.5)$.
5.  Counts the number of points in each region.

And I get 2280 for the first region and 973 for the second.

Again, I'll include below the changes I made to get the Github sources
to run in Gambit.

I don't have any ideas right now.

Brad

heine:/tmp/srfi-194> git diff
diff --git a/srfi-194-test.scm b/srfi-194-test.scm
index b066f91..06f45ed 100644
--- a/srfi-194-test.scm
+++ b/srfi-194-test.scm
@@ -13,7 +13,7 @@
    (scheme write)
    (srfi 1)
    (srfi 27)
-  (srfi 133)
+  #;(srfi 133)
    (srfi 194))

  (cond-expand
@@ -137,7 +137,9 @@
                                     (lambda ()
(make-random-integer-generator 0 10)))
                                   5))
                          '(4 9 7 9 0)))
-                (apply test-multiple-sources multiple-sources-testcase))))
+                (apply test-multiple-sources multiple-sources-testcase)))
+  (else
+   #f))

  (test-group "Test make-random-source-generator"
              (reset-source!)
diff --git a/srfi/194.scm b/srfi/194.scm
index fa875d7..3721e8d 100644
--- a/srfi/194.scm
+++ b/srfi/194.scm
@@ -2,13 +2,14 @@
  ; SPDX-License-Identifier: MIT

  (define-library (srfi 194)
-  (import (scheme base)
+  (import (gambit) ;; (scheme base)
            (scheme case-lambda)
            (scheme inexact)
            (scheme complex)
            (scheme write)
            (srfi 27)
-          (srfi 133))
+          #;(srfi 133)
+          )

    (cond-expand
      ((library (srfi 158)) (import (srfi 158)))
diff --git a/zipf-test.scm b/zipf-test.scm
index 47c8cfa..9a34bd4 100644
--- a/zipf-test.scm
+++ b/zipf-test.scm
@@ -64,7 +64,8 @@

    ; Sequence 1..NVOCAB
    (define seq
-    (vector-unfold (lambda (i x) (values x (+ x 1))) NVOCAB 1))
+    #;(vector-unfold (lambda (i x) (values x (+ x 1))) NVOCAB 1)
+    (list->vector (iota NVOCAB 1)))

    ; Sequence  1/(k+QUE)^ESS
    (define inv-pow (vector-map