Added copy-vector.
This commit is contained in:
parent
e7460b6e74
commit
112a51bd10
|
@ -102,6 +102,13 @@
|
||||||
(and (pred (vector-ref v i))
|
(and (pred (vector-ref v i))
|
||||||
(lp (- i 1))))))
|
(lp (- i 1))))))
|
||||||
|
|
||||||
|
(define (copy-vector v)
|
||||||
|
(let* ((len (vector-length v))
|
||||||
|
(ans (make-vector len)))
|
||||||
|
(do ((i (- len 1) (- i 1)))
|
||||||
|
((< i 0) ans)
|
||||||
|
(vector-set! ans i (vector-ref v i)))))
|
||||||
|
|
||||||
;;; These two utility funs are for parsing optional last arguments,
|
;;; These two utility funs are for parsing optional last arguments,
|
||||||
;;; e.g. the PORT arg in
|
;;; e.g. the PORT arg in
|
||||||
;;; (write-string string [port])
|
;;; (write-string string [port])
|
||||||
|
|
Loading…
Reference in New Issue