1 (in-package :alexandria
)
3 (defun copy-array (array &key
(element-type (array-element-type array
))
4 (fill-pointer (and (array-has-fill-pointer-p array
)
6 (adjustable (adjustable-array-p array
)))
7 "Returns an undisplaced copy of ARRAY, with same fill-pointer and
8 adjustability (if any) as the original, unless overridden by the keyword
10 (let* ((dimensions (array-dimensions array
))
11 (new-array (make-array dimensions
12 :element-type element-type
13 :adjustable adjustable
14 :fill-pointer fill-pointer
)))
15 (dotimes (i (array-total-size array
))
16 (setf (row-major-aref new-array i
)
17 (row-major-aref array i
)))