vector<->list conversion

This commit is contained in:
Yuichi Nishiwaki 2013-11-17 18:35:45 +09:00
parent d675ce1c80
commit ca66291d93
1 changed files with 14 additions and 0 deletions

View File

@ -390,6 +390,20 @@
v)
(vector-set! v i (car l))))))
(define (vector->list vector . opts)
(let ((start (if (pair? opts) (car opts) 0))
(end (if (>= (length opts) 2)
(cadr opts)
(vector-length vector))))
(do ((i start (+ i 1))
(res '()))
((< i end)
(reverse res))
(set! res (cons (vector-ref vector i) res)))))
(define (list->vector list)
(apply vector list))
(define (vector-copy! to at from . opts)
(let ((start (if (pair? opts) (car opts) 0))
(end (if (>= (length opts) 2)