1234567891011121314151617 |
- (define (vector->list v)
- (let ((l (vector-length v)))
- (let loop ((i 0))
- (if (= i l)
- '()
- (cons (vector-ref v i)
- (loop (+ i 1)))))))
- (define (list->vector l)
- (let ((len (length l)))
- (let ((v (make-vector len #f)))
- (let loop ((i 0) (l l))
- (if (= i len)
- v
- (begin (vector-set! v i (car l))
- (loop (+ i 1) (cdr l))))))))
|