What it is
The Lisp
SimpleArray type is an array that is not displaced to another array. It has no fill pointer and it is not adjustable.
A
SimpleArray is an array, thus the
SimpleArray type is a subtype of
LispArray, and implements all the functions that
LispArray implements, except in the case of the fill pointer and dynamic adjustment of its size.
The
SimpleArray type has the disjoint subtypes
SimpleVector,
SimpleString, and
SimpleBitVector.
What it means
As it says above, a
SimpleArray is an array that is not displaced to another array. What this means in practice is that a
SimpleArray is the Lisp analogue to the sort of generic multi-dimensional array you would find in a language like Java or Perl. It isn't adjustable, which means that once created, the dimensions of a
SimpleArray cannot be modified. It is never displaced onto another array.
Implementation, or how it's done
The
SimpleArray type will be implemented as an interface in the lisp.common.type package (as are the rest of the Lisp types in
CLforJava.) New instances of
SimpleArray will be created using a Factory class. Backing store will be a native Java array. Note that a
SimpleArray can never share the backing store of another array.
All Lisp functions that operate on
LispArray should operate identically on
SimpleArray, save in the following cases:
| Lisp function |
SimpleArray behaviour |
| ADJUST-ARRAY |
throws an error |
| ADJUSTABLE-ARRAY-P |
returns BOOLEAN.NIL |
| ARRAY-HAS-FILL-POINTER-P |
returns BOOLEAN.NIL |
| ARRAY-DISPLACEMENT |
returns BOOLEAN.NIL and 0 |
| FILL-POINTER |
throws an error |
References
StringsAndArrays
Discussions
SimpleArray discussion on the Forum
--
KitPeters - 05 Oct 2005
Topic revision: r6 - 2009-02-11 - 19:25:30 -
MeganLusher