Aref2
Access the elements of a 2-dimensional array
Example Form:
(aref2 'delta1 a i j)
General Form:
(aref2 name alist i j)
where name is a symbol, alist is a 2-dimensional array and i
and j are legal indices into alist. This function returns the value
associated with (i . j) in alist, or else the default value of the
array. See arrays for details.
This function executes in virtually constant time if alist is in fact
the ``semantic value'' associated with name (see arrays). When it
is not, aref2 must do a linear search through alist. In that case
the correct answer is returned but a slow array comment is printed to
the comment window. See slow-array-warning.
Function: aref2
(defun aref2 (name l i j)
(declare (xargs :guard (and (array2p name l)
(integerp i)
(>= i 0)
(< i (car (dimensions name l)))
(integerp j)
(>= j 0)
(< j (cadr (dimensions name l))))))
(let ((x (assoc2 i j l)))
(cond ((null x) (default name l))
(t (cdr x)))))