Compress2
Remove irrelevant pairs from a 2-dimensional array
Example Form:
(compress2 'delta1 a)
General Form:
(compress2 name alist)
where name is a symbol and alist is a 2-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
aref2, is everywhere equal to alist. That is, (aref2 name
alist' i j) is (aref2 name alist i j), for all legal indices i and
j. Alist' may be shorter than alist and the non-irrelevant
pairs may occur in a different order in alist' than in alist.
Practically speaking, this function plays an important role in the
efficient implementation of aref2. In addition to creating the new
array, alist', compress2 makes that array the ``semantic value'' of
name and allocates a raw lisp array to name. For all legal indices,
i and j, that raw lisp array contains (aref2 name alist' i j)
in slot i,j. Thus, subsequent aref2 operations can be
executed in virtually constant time provided they are given name and the
alist' returned by the most recently executed compress2 or aset2 on name. See arrays.
Function: compress2
(defun compress2 (name l)
(declare (xargs :guard (array2p name l)))
(cons (header name l)
(compress21 name l 0 (car (dimensions name l))
(cadr (dimensions name l))
(default name l))))