From b19df05e81494a368e16dbdbf5709af3cda2ac84 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 17 Nov 2013 17:33:37 +0900 Subject: [PATCH] add vector-fill! --- piclib/built-in.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/piclib/built-in.scm b/piclib/built-in.scm index 53ba52ed..9efacf4f 100644 --- a/piclib/built-in.scm +++ b/piclib/built-in.scm @@ -417,6 +417,16 @@ res)) (fold vector-append-2-inv #() vs)) +(define (vector-fill! v fill . opts) + (let ((start (if (pair? opts) (car opts) 0)) + (end (if (>= (length opts) 2) + (cadr opts) + (vector-length v)))) + (do ((i start (+ i 1))) + ((< i end) + #f) + (vector-set! v i fill)))) + ;;; 6.9 bytevector (define (bytevector . objs)