Julia's AbstractArray like abstraction for Common Lisp.
This system/library provides an
abstract-array package with:
- aref and (setf aref)
- row-major-aref and (setf row-major-aref)
compile time facilities:
Alpha: Will potentially be removed
- array operators:
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.
Follow the instructions at https://github.com/digikar99/adhoc-polymorphic-functions/#getting-it-from-ultralisp
- Firstly subclass
abstract-array-classto create the metaclass
my-array-classfor your own array.
abstract-arrayclass with metaclass as
my-array-metaclassto create the class*
abstract-arrayclass may have additional slots as per its requirements. It is recommended that users use
define-array-classmacro for this purpose as this also defines the order of slots appropriately.
- Implement polymorphs for
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.
- Create a sparse-array class with as many array operations as possible :)
- Use abstract-arrays and/or dense-arrays and report any issues!