ashinn / chibi-scheme

Official chibi-scheme repository
Other
1.23k stars 141 forks source link

SRFI 231: fix for interval-contains-multi-index? #974

Closed gambiteer closed 6 months ago

gambiteer commented 6 months ago

Fix for zero-dimensional intervals:

heine:~/programs/chibi-scheme> git diff
diff --git a/lib/srfi/231/base.scm b/lib/srfi/231/base.scm
index 6f0f3643..7c302e5d 100644
--- a/lib/srfi/231/base.scm
+++ b/lib/srfi/231/base.scm
@@ -108,9 +108,9 @@
   (and (vector-every >= (interval-lb iv1) (interval-lb iv2))
        (vector-every <= (interval-ub iv1) (interval-ub iv2))))

-(define (interval-contains-multi-index? iv i0 . o)
+(define (interval-contains-multi-index? iv . o)
   (assert (interval? iv))
-  (let ((i (list->vector (cons i0 o))))
+  (let ((i (list->vector o)))
     (assert (and (= (interval-dimension iv) (vector-length i))
                  (vector-every integer? i)))
     (and (vector-every >= i (interval-lb iv))