[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
adjusting displaced arrays
Date: 15 May 1986 19:26-EDT
(DEFUN AREF (ORIGINAL-ARRAY &REST SUBSCRIPTS)
(LABELS ((FOO (ARRAY INDEX)
It would be a tad clearer if FOO were called 1D-AREF
(MULTIPLE-VALUE-BIND (NEW-ARRAY OFFSET) (DISPLACED-ARRAY-P ARRAY)
(IF (NULL NEW-ARRAY)
(ROW-MAJOR-AREF ARRAY INDEX)
ROW-MAJOR-AREF isn't a CL primitive. Our system calls is SYS:%1D-AREF.
It's not clear you need to call it row-major-aref either, as the
row-major part of the computation is dealt with below.
You don't need multiple-value-call; FOO takes exactly two arguments.
(+ INDEX OFFSET)))))
(APPLY #'ARRAY-ROW-MAJOR-INDEX ORIGINAL-ARRAY SUBSCRIPTS))))
I think this is a reasonable extension, but I think it also must warn
users that since arrays are adjustable, and indirect chain can be
changed, and therefore, the target of repeated calls to
DISPLACED-ARRAY-P should not be cached.