diff options
author | David Thompson <dthompson2@worcester.edu> | 2020-09-29 16:44:01 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2020-09-29 16:44:29 -0400 |
commit | dba391852d761c8f18e723592f351a0d9b375b99 (patch) | |
tree | 4edee610c809b7b6d2c9e7e97e95eebbf31f94ff | |
parent | fea6f5d467affbd699ef70aeb3cf69af1629bebe (diff) |
array-list: Expand by 1.5x rather than 2x.
-rw-r--r-- | chickadee/array-list.scm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/chickadee/array-list.scm b/chickadee/array-list.scm index da450c8..0150cce 100644 --- a/chickadee/array-list.scm +++ b/chickadee/array-list.scm @@ -17,6 +17,7 @@ (define-module (chickadee array-list) #:use-module (ice-9 format) + #:use-module (rnrs base) #:use-module (srfi srfi-9) #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-43) @@ -72,7 +73,8 @@ (define (expand-array-list! array-list) (let* ((old-vec (array-list-vector array-list)) - (new-size (* (vector-length old-vec) 2)) + (old-size (vector-length old-vec)) + (new-size (+ old-size (div old-size 2))) (new-vec (make-vector new-size))) (vector-copy! new-vec 0 old-vec) (set-array-list-vector! array-list new-vec))) |