[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ADJUST-ARRAY-DISPLACEMENT



Unless there's a compelling reason not to, I think it's important to always
make ``keyword NIL'' mean the same as not having supplied the keyword. There's
only a few cases where we violate this and if anything we should be working
on reducing the number of cases.

I think :DISPLACED-TO NIL should copy into a new area and give back a 
non-displaced array, so I agree that this should be the behavior in the
case of omitting :DISPLACED-TO.

Since we're guaranteeing that levels of array displacement will never
be optimized out, it would seem to me reasonable to provide functions
to ask an array whether it is displaced, and if so to what at what index.
Perhaps:

ARRAY-DISPLACED-TO array				[Function]
 Returns the array to which the argument <array> is displaced, or
 NIL if the argument <array> is not displaced.

ARRAY-DISPLACED-INDEX-OFFSET array			[Function]
 Returns the displaced-index-offset of the argument <array>, or
 NIL if the argument <array> is not displaced. (If <array> has been
 displaced to another array, but no displaced-index-offset was specified,
 this function returns 0.)

Example:
 (ADJUST-ARRAY THE-ARRAY THE-NEW-DIMENSIONS
   :DISPLACED-TO (ARRAY-DISPLACED-TO THE-ARRAY)
   :DISPLACED-INDEX-OFFSET (ARRAY-DISPLACED-INDEX-OFFSET THE-ARRAY))

These operations might also be of use to certain people wanting to write
highly optimized array manipulation code that wanted to accept arguments
which might be displaced arrays, but which didn't want to have to incur the
displacement overhead internally.