scm.mes: make-vector: fix fill.
This commit is contained in:
parent
dc5e39926a
commit
04f0eed66a
2
scm.mes
2
scm.mes
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
(define (vector . rest) (list->vector rest))
|
(define (vector . rest) (list->vector rest))
|
||||||
(define (make-vector n . x)
|
(define (make-vector n . x)
|
||||||
(let ((fill (if (pair? x) (cdr x) *unspecified*)))
|
(let ((fill (if (pair? x) (car x) *unspecified*)))
|
||||||
(list->vector (let loop ((n n))
|
(list->vector (let loop ((n n))
|
||||||
(if (= 0 n) '()
|
(if (= 0 n) '()
|
||||||
(cons fill (loop (- n 1))))))))
|
(cons fill (loop (- n 1))))))))
|
||||||
|
|
3
test.mes
3
test.mes
|
@ -127,6 +127,9 @@
|
||||||
(pass-if "vector-length" (seq? (vector-length #(1)) 1))
|
(pass-if "vector-length" (seq? (vector-length #(1)) 1))
|
||||||
(pass-if "list->vector" (sequal? (list->vector '(a b c)) #(a b c)))
|
(pass-if "list->vector" (sequal? (list->vector '(a b c)) #(a b c)))
|
||||||
(pass-if "vector" (sequal? #(vector 0 1 2) #(vector 0 1 2)))
|
(pass-if "vector" (sequal? #(vector 0 1 2) #(vector 0 1 2)))
|
||||||
|
(when (not guile?)
|
||||||
|
(pass-if "make-vector" (sequal? (make-vector 3) #(*unspecified* *unspecified* *unspecified*))))
|
||||||
|
(pass-if "make-vector 2" (sequal? (make-vector 3 0) #(0 0 0)))
|
||||||
(pass-if "vector-ref" (seq? (vector-ref #(0 1) 1) 1))
|
(pass-if "vector-ref" (seq? (vector-ref #(0 1) 1) 1))
|
||||||
(when (not guile?) ;; hmm guile segfaults
|
(when (not guile?) ;; hmm guile segfaults
|
||||||
(pass-if "vector-set" (equal? (let ((v #(0 1))) (vector-set! v 1 'q) v) #(0 q)))
|
(pass-if "vector-set" (equal? (let ((v #(0 1))) (vector-set! v 1 'q) v) #(0 q)))
|
||||||
|
|
Loading…
Reference in a new issue