[unmaintained, maintainers welcome] A generalized interface for array-like objects with views.

Prolific author of this library has switched to another language. According to him, would-be maintainer should fork and maintain for a year, announce the library resurrection, drop him an e-mail so he would redirect users, and convince Zach Beane to use the fork in Quicklisp.

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 two-dimensional array *a*,

(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 9. Changes will be made in the original array *a*, 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.

Homepage: https://github.com/tpapp/xarray

License: MIT

See Also: cl-slice

Topics: language extension