User Tools


Function ARRAY-DISPLACEMENT

Syntax

  • array-displacement arraydisplaced-to, displaced-index-offset

Arguments and Values

  • array - an array.
  • displaced-to - an array or nil.
  • displaced-index-offset - a non-negative fixnum.

Description

If the array is a displaced array, returns the values of the :displaced-to and :displaced-index-offset options for the array (see the functions make-array and adjust-array). If the array is not a displaced array, nil and 0 are returned.

If array-displacement is called on an array for which a non-nil object was provided as the :displaced-to argument to make-array or adjust-array, it must return that object as its first value. It is implementation-dependent whether array-displacement returns a non-nil primary value for any other array.

Examples

(defparameter *a1* (make-array 5))

*A1*

(defparameter *a2* (make-array 4 :displaced-to *a1* :displaced-index-offset 1))

*A2*

(array-displacement *a2*)

#<ARRAY 5 simple 46115576> 1

(defparameter *a3* (make-array 2 :displaced-to *a2* :displaced-index-offset 2))

*A3*

(array-displacement *a3*)

#<ARRAY 4 indirect 46117134> 2

Affected By

None.

Exceptional Situations

Should signal an error of type type-error if array is not an array.

See Also

Notes

None.

\issue{DISPLACED-ARRAY-PREDICATE:ADD}