diff --git a/scsh/utilities.scm b/scsh/utilities.scm index 7fca411..c70a07e 100644 --- a/scsh/utilities.scm +++ b/scsh/utilities.scm @@ -109,6 +109,12 @@ ((< i 0) ans) (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) (if (pred val) val (check-arg pred (error "Bad argument" val pred caller) caller)))