add vector-append

This commit is contained in:
Yuichi Nishiwaki 2013-11-17 13:13:16 +09:00
parent 5947240614
commit 6d825666e2
1 changed files with 13 additions and 0 deletions

View File

@ -140,6 +140,11 @@
(any pred (cdr list)))) (any pred (cdr list))))
(pred (car list))))) (pred (car list)))))
(define (fold f s xs)
(if (null? xs)
s
(fold f (f (car xs) s) (cdr xs))))
(define (map f list . lists) (define (map f list . lists)
(define (single-map f list) (define (single-map f list)
(if (null? list) (if (null? list)
@ -404,6 +409,14 @@
(vector-copy! res 0 v start end) (vector-copy! res 0 v start end)
res))) res)))
(define (vector-append . vs)
(define (vector-append-2-inv w v)
(let ((res (make-vector (+ (vector-length v) (vector-length w)))))
(vector-copy! res 0 v)
(vector-copy! res (vector-length v) w)
res))
(fold vector-append-2-inv #() vs))
;;; 6.9 bytevector ;;; 6.9 bytevector
(define (bytevector . objs) (define (bytevector . objs)