Added INITIALIZE-VECTOR

This commit is contained in:
shivers 1996-09-12 01:39:18 +00:00
parent ae2b8700e5
commit dfda637610
1 changed files with 6 additions and 0 deletions

View File

@ -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)))