xarray
xarray is a generalized interface for array-like objects with views.

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.[1] 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.

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

License: MIT


Topics: language extension

ASDF-install package (obsolete) http://github.com/tpapp/xarray/tarball/master