Simplified Common Lisp reference
make-array
Symbol class: Sequences (Lists, Strings) and Arrays
Syntax:
Symbol type: function
make-arraydimensionselement-type(keyword)initial-element(keyword)initial-contents(keyword)adjustable(keyword)fill-pointer(keyword)displaced-to(keyword)displaced-index-offset(keyword) => an array
Argument description:
dimensions list of dimensions, or non-negative integer
element-type a type specifier, default is T - any type
initial-element a value, default is implementation dependent
initial-contents an object
adjustable a generalized boolean, default is NIL
fill-pointer a valid fill pointer for the array, or T or NIL
displaced-to an array or NIL, default is NIL
displaced-index-offset a valid array row-major index for displaced arrays, default is 0

MAKE-ARRAY function creates a new array. Array can be adjustable if specified, that is its dimensions can be shrinked or enlarged by ADJUST-ARRAY function.

One-dimensional arrays can have a fill-pointer. Fill-pointer makes array look like as if it would be shorter with only as many elements as fill-pointer specifies - while elements at the real end of array a still retained. Such array can be very easily enlarged or shrinked in bounds of the real size just by setting fill-pointer which is very fast. Functions like VECTOR-PUSH, VECTOR-PUSH-EXTEND and VECTOR-POP make use of this.

Arrays can be displaced onto another array. Such array can have different dimensions and elements are shared on underlying row-major element order.

See also AREF, ELT, ADJUST-ARRAY, ARRAY-DIMENSION, ARRAY-DIMENSIONS, FILL-POINTER, ARRAY-IN-BOUNDS-P, ARRAY-ROW-MAJOR-INDEX, ARRAYP.

(make-array 5 :initial-element 'x) => #(X X X X X)
(make-array '(2 3) :initial-element 'x) => #2A((X X X) (X X X))
(length (make-array 10 :fill-pointer 4)) => 4
(array-dimensions (make-array 10 :fill-pointer 4)) => (10)
(make-array 10 :element-type 'bit :initial-element 0) => #*0000000000
(make-array 10 :element-type 'character :initial-element #\a) => "aaaaaaaaaa"
(let ((a (make-array '(2 2) :initial-element 'x :adjustable t))) (adjust-array a '(1 3) :initial-element 'y) a) => #2A((X X Y))
Function indexFull documentation for make-array (HyperSpec)