From 318475c14b0efe6f7d1635403e6ec54399689721 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Tue, 15 Jul 2014 22:27:48 +0900 Subject: [PATCH] optional argument for make-array --- piclib/picrin/array.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/piclib/picrin/array.scm b/piclib/picrin/array.scm index 7fc6f050..bc667ac8 100644 --- a/piclib/picrin/array.scm +++ b/piclib/picrin/array.scm @@ -34,7 +34,12 @@ (set-array-size! ary size))) (define (make-array . rest) - (create-array (vector) 0 0 0)) + (if (null? rest) + (make-array 0) + (let ((capacity (car rest)) + (ary (create-array (vector) 0 0 0))) + (array-reserve! ary capacity) + ary))) (define (array-ref ary i) (let ((data (array-data ary)))