Lexicographical access to arrays
John Cowan 09 Apr 2026 18:59 UTC
Common Lisp has an accessor (array-major-aref a n) which retrieves the
nth element of an array enumerated in lexicographical order. As such,
it also comes with a setter: (setf (array-major-aref a n) x) where x
is the new value. Setf is equivalent to SRFI 17's version of `set!`,
and replaces essentially all mutator functions in CL (rplaca and
rplacd are still there for hysterical raisins).
It seems partly possible to emulate this using array-body and
array-indexer, but then you have to know what kind of body you have
(vector, @vector, or something else). I think it would be worth
adding these. (Maybe there's a way to do them already, in which case
it would be worth pointing it out in 231bis.)