COMPRESS1

remove irrelevant pairs from a 1-dimensional array
Major Section:  ARRAYS

Example Form:
(compress1 'delta1 a)

General Form:
(compress1 name alist)
where name is a symbol and alist is a 1-dimensional array, generally named name. See arrays for details. Logically speaking, this function removes irrelevant pairs from alist, possibly shortening it. The function returns a new array, alist', with the same header (including name and dimension) as alist, that, under aref1, is everywhere equal to alist. That is, (aref1 name alist' i) is (aref1 name alist i), for all legal indices i. Alist' may be shorter than alist and the non-irrelevant pairs may occur in a different order than in alist.

Practically speaking, this function plays an important role in the efficient implementation of aref1. In addition to creating the new array, alist', compress1 makes that array the ``semantic value'' of name and allocates a raw lisp array to name. For each legal index, i, that raw lisp array contains (aref1 name alist' i) in slot i. Thus, subsequent aref1 operations can be executed in virtually constant time provided they are given name and the alist' returned by the most recently executed compress1 or aset1 on name. See arrays.

In general, compress1 returns an alist whose cdr is an association list whose keys are nonnegative integers in ascending order. However, if the header specifies an :order of > then the keys will occur in descending order, and if the :order is :none or nil then the keys will not be sorted, i.e., compress1 is logically the identity function (though it still attaches an array under the hood). Note however that a compress1 call is replaced by a hard error if the header specifies an :order of :none or nil and the array's length exceeds the maximum-length field of its header.