Creates and returns a new array which, in addition to the standard functionality, can be a weak array or statically allocated.
make-array dimensions &key element-type initial-element initial-contents adjustable fill-pointer displaced-to displaced-index-offset weak allocation => new-array
The standard definition of
make-array
is extended to accept the keyword arguments
:weak
and
:allocation
.
If
weak
is non-
nil
, then
displaced-to
must be
nil
and if
element-type
is supplied it must have
upgraded-array-element-type
t
, otherwise an error is signalled. That is, you cannot make a weak array which is displaced or has
array-element-type
other than
t
. When
weak
is non-
nil
, it makes
new-array
weak.
If
weak
is
nil
, then
make-array
behaves in the standard way, and
new-array
is not weak. The value
weak
defaults to
nil
.
See set-array-weak for a description of weak arrays.
The possible values for allocation have the following meanings:
Allocate the array normally.
Same meaning as
:new
Allocate the array in a static segment.
Allocate the array assuming it is going to be long-lived.
Same meaning as
:long-lived
Allocate the array in generation n .
Arrays (including strings) that are passed by address to foreign functions must be static, and so must should be created with
:allocation :static
.
Allocation with
:old
or
:long-lived
is useful when you know that the array will be long-lived, because your program will avoid the overhead of promoting it to the older generations.