next up previous contents index
Next: Bit-Vectors Up: Object Representation Previous: Arrays   Contents   Index


Vectors

efficiency of

Vectors (one dimensional arrays) are particularly useful, since in addition to their obvious array-like applications, they are also well suited to representing sequences. In comparison to a list representation, vectors are faster to access and take up between two and sixty-four times less space (depending on the element type.) As with arbitrary arrays, the compiler needs to know that vectors are not complex, so you should use simple-string in preference tostring, etc.

The only advantage that lists have over vectors for representing sequences is that it is easy to change the length of a list, add to it and remove items from it. Likely signs of archaic, slow lisp code arenth and nthcdr. If you are using these functions you should probably be using a vector.



Peter Van Eynde 2000-02-08