Allow vector-append to take zero arguments

Makes vector-append behave more like append, sequence-append, etc.
This commit is contained in:
Justin Slepak 2012-05-25 21:00:45 -04:00 committed by Vincent St-Amour
parent 74844152bc
commit 2f23f1b6b3

View File

@ -169,9 +169,8 @@
(values (vector-copy* v 0 (unsafe-fx- len n)) (values (vector-copy* v 0 (unsafe-fx- len n))
(vector-copy* v (unsafe-fx- len n) len)))) (vector-copy* v (unsafe-fx- len n) len))))
(define (vector-append v . vs) (define (vector-append . vs)
(let* ([vs (cons v vs)] (let* ([lens (for/list ([e (in-list vs)] [i (in-naturals)])
[lens (for/list ([e (in-list vs)] [i (in-naturals)])
(if (vector? e) (if (vector? e)
(unsafe-vector-length e) (unsafe-vector-length e)
(raise-argument-error 'vector-append "vector?" e i)))] (raise-argument-error 'vector-append "vector?" e i)))]