Added a faster loop based remove-from-plist
[alexandria.git] / arrays.lisp
blob11946187661ac69e6c66fa7721fcd55d01d7a882
1 (in-package :alexandria)
3 (deftype array-index (&optional (length array-dimension-limit))
4 "Type designator for an array of LENGTH: an integer between 0 (inclusive) and
5 LENGTH (exclusive). LENGTH defaults to ARRAY-DIMENSION-LIMIT."
6 `(integer 0 (,length)))
8 (defun copy-array (array &key
9 (element-type (array-element-type array))
10 (fill-pointer (and (array-has-fill-pointer-p array)
11 (fill-pointer array)))
12 (adjustable (adjustable-array-p array)))
13 "Returns an undisplaced copy of ARRAY, with same fill-pointer
14 and adjustability (if any) as the original, unless overridden by
15 the keyword arguments."
16 (let ((dims (array-dimensions array)))
17 ;; Dictionary entry for ADJUST-ARRAY requires adjusting a
18 ;; displaced array to a non-displaced one to make a copy.
19 (adjust-array
20 (make-array dims
21 :element-type element-type :fill-pointer fill-pointer
22 :adjustable adjustable :displaced-to array)
23 dims)))