Added INITIALIZE-VECTOR
This commit is contained in:
parent
ae2b8700e5
commit
dfda637610
|
@ -109,6 +109,12 @@
|
||||||
((< i 0) ans)
|
((< i 0) ans)
|
||||||
(vector-set! ans i (vector-ref v i)))))
|
(vector-set! ans i (vector-ref v i)))))
|
||||||
|
|
||||||
|
(define (initialize-vector len init)
|
||||||
|
(let ((v (make-vector len)))
|
||||||
|
(do ((i (- len 1) (- i 1)))
|
||||||
|
((< i 0) v)
|
||||||
|
(vector-set! v i (init i)))))
|
||||||
|
|
||||||
(define (check-arg pred val caller)
|
(define (check-arg pred val caller)
|
||||||
(if (pred val) val
|
(if (pred val) val
|
||||||
(check-arg pred (error "Bad argument" val pred caller) caller)))
|
(check-arg pred (error "Bad argument" val pred caller) caller)))
|
||||||
|
|
Loading…
Reference in New Issue