mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Fix SRFI 133 vector-every crash on empty vector
This commit is contained in:
parent
abe8ca3b95
commit
18a5776587
1 changed files with 7 additions and 6 deletions
|
@ -163,12 +163,13 @@
|
|||
|
||||
(define (vector-every pred? vec1 . o)
|
||||
(let ((len (apply min (vector-length vec1) (map vector-length o))))
|
||||
(let lp ((i 0))
|
||||
(let ((x (apply pred? (vector-ref vec1 i)
|
||||
(map (lambda (v) (vector-ref v i)) o))))
|
||||
(if (= i (- len 1))
|
||||
x
|
||||
(and x (lp (+ i 1))))))))
|
||||
(or (zero? len)
|
||||
(let lp ((i 0))
|
||||
(let ((x (apply pred? (vector-ref vec1 i)
|
||||
(map (lambda (v) (vector-ref v i)) o))))
|
||||
(if (= i (- len 1))
|
||||
x
|
||||
(and x (lp (+ i 1)))))))))
|
||||
|
||||
(define (vector-swap! vec i j)
|
||||
(let ((tmp (vector-ref vec i)))
|
||||
|
|
Loading…
Add table
Reference in a new issue