Home

Awesome

abstract-arrays

This system/library provides an abstract-array package with:

Beta

Alpha: Will potentially be removed

The slot-readers and array-operators are implemented using polymorphic-functions to allow for [more-or-less] portable inlining and installation of compiler-macros wherever appropriate. An attempt has also been made to optimize slot accesses using ordered-class discovered at mfiano/zed.

The compile time facilities allows one to define array specialization types using deftype that specialize on element-type and rank - without a corresponding explosion in the number of predicates. The specialization is done using a systematic arrangement of predicates that check for element-type or rank. These should also obey subtypep due to their arrangement.

The system also wraps around the CL symbols with the same names. Thus, for example, abstract-arrays:array-dimensions when compiled with appropriate type declarations is as efficient as cl:array-dimensions. More documentation lives inside docstrings.

Installation

TODO

Usage

  1. Firstly subclass abstract-array-class to create the metaclass my-array-class for your own array.
  2. Subclass abstract-array class with metaclass as my-array-metaclass to create the class* my-array. This abstract-array class may have additional slots as per its requirements. It is recommended that users use define-array-class macro for this purpose as this also defines the order of slots appropriately.
  3. Implement polymorphs for aref, (setf aref), row-major-aref and (setf row-major-aref).

The system of metaclass and class was chosen as it aids in customizing the behavior of my-array. For an extensive example, see dense-arrays/src/protocol.lisp.

To Contribute