[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
adjusting displaced arrays
- To: NGALL@G.BBN.COM, common-lisp@SU-AI.ARPA
- Subject: adjusting displaced arrays
- From: David C. Plummer <DCP@SCRC-QUABBIN.ARPA>
- Date: Fri, 16 May 86 10:22 EDT
- In-reply-to: <[G.BBN.COM]15-May-86 19:26:22.NGALL>
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.