(rontolisp) docs
← Functions

make-array

(make-array dimensions &key initial-element fill-pointer adjustable displaced-to displaced-index-offset)

Creates and returns a new array. dimensions is an integer for a rank-1 vector, or a non-empty list of integers for an array of any rank. :initial-element sets every cell to the given value, defaulting to nil. Elements are stored row-major with O(1) access via aref, and arrays are compared by identity (eq), so two distinct arrays are never equal. make-array and aref are not first-class function values -- #'make-array is unavailable, so call it directly.

:fill-pointer (rank-1 only) gives the vector a fill pointer: an integer sets it to that position, t to the vector size. The fill pointer is the effective length -- length and printing stop at it, while aref still reaches the full storage -- and is what vector-push/vector-pop/vector-push-extend operate on. :adjustable marks the array adjustable, reported verbatim by adjustable-array-p; an adjustable array is resized in place by adjust-array. :element-type is accepted but ignored (element types are not tracked; array-element-type always returns t).

:displaced-to builds a view over another array's storage instead of allocating one: element i (row-major) of the view reads and writes element i + offset of the target, where :displaced-index-offset defaults to 0, so changes are visible in both directions. The view has its own dimensions (they may differ in rank from the target's, e.g. a vector view over a matrix row), must fit inside the target, and is inspected with array-displacement. A displaced view cannot be combined with :fill-pointer, :adjustable or :initial-element, and cannot itself be adjusted.