This package implements a generalized interface for array-like
objects. The idea is that we should be able to index an object as
(xref object 1 2 3)
to retrieve or set an element. This would be easy to do it aref was a
generic function, but it is not. I describe a simple interface with a
few generic functions (xdims queries dimensions, xtype element type,
etc), any objects that has these methods is called "xrefable".
The nice part is that views on an array can also be xrefable. For an
(slice *a* :all 4)
selects the 4th column of an array.¹ This view is also xrefable, so
you can use
(setf (xref (slice *a* :all 4) 2) 9)
to set element 2 to
. Changes will be made in the original array
, since this is a view. But for functions that just expect an
array, they can use the interface (xref, xdims, etc) and not care
where it is coming from.
¹ The slice interface is similar to author's affi package, but now
arbitrary index vectors are allowed.
See Also: cl-slice
Topics: language extension