#|
http://www.lispworks.com/documentation/HyperSpec/Body/15_aaa.htm
An array element is referred to by a (possibly empty) series of
indices.
The length of the series must equal the rank of the array.
#|
(let ((a (make-array 24)))
(dotimes (i (array-total-size a))
(setf (aref a i) i))
a)
; Commentary - in the following code, I refer to the elements of array
"a"
; using a set of 24 series of indices
(dotimes (i 2)
(dotimes (j 3)
(dotimes (k 4)
(format t "~%~2d : ~A,~A,~A" (+ (* 12 i) (* 4 j) k) i j k))))
; Question - in the spec text below, what is a multidimensional index
set?
; Why do they use the word set in the plural? From what I can see,
there is
; one index set for the array "a" above and I created it with my
dotimes
; loop.
; Somewhat answering my own question, my guess is that there are n
index
; sets for a multidimensional array, where n is any factorization of
; array-total-size. That is, for my 2x3x4 array, we could have an
index set
; for a 2x12 array, a 1x24 array, a 6x4 array, etc.
; Please advise if:
; (a) I have created 1 index set above with my nested dotimes loops
; (b) The reason they used "index set" in the plural is because a
single
; vector of data can be conceived as several different n-
dimensional
; arrays.
; This whole question is really just a rehash of my recent
conversation
; with Allan Crowe, but I want to make sure that I really understand
; what this spec if saying.
; Looking a bit deeper into the spec, I see that my calculation of
; the vector position of an array element is nothing but a hardcoded
; implementation of array-row-major-index:
; http://www.lispworks.com/documentation/HyperSpec/Body/f_ar_row.htm#array-row-major-index
#|
http://www.lispworks.com/documentation/HyperSpec/Body/15_aacba.htm
15.1.1.3.2.1 Storage Layout for Multidimensional Arrays
Multidimensional arrays store their components in row-major order;
that is,
internally a multidimensional array is stored as a one-dimensional
array, with the multidimensional index sets ordered
lexicographically,
last index varying fastest.
#|
From: Maciej Katafiasz
Subject: Re: Multidimensional array storage referred to as "index sets" in spec
Date:
Message-ID: <fjp5en$ctm$2@news.net.uni-c.dk>
Den Wed, 12 Dec 2007 05:49:13 -0800 skrev metaperl.com:
> #|
> http://www.lispworks.com/documentation/HyperSpec/Body/15_aaa.htm
>
> An array element is referred to by a (possibly empty) series of indices.
> The length of the series must equal the rank of the array.
> #|
Do you mean |# here (and at the end of the code), or did your post get
horribly mangled somewhere along the tubes?
Cheers,
Maciej
On Dec 12, 12:23 pm, Maciej Katafiasz <········@gmail.com> wrote:
> Den Wed, 12 Dec 2007 05:49:13 -0800 skrev metaperl.com:
>
> > #|
> >http://www.lispworks.com/documentation/HyperSpec/Body/15_aaa.htm
>
> > An array element is referred to by a (possibly empty) series of indices.
> > The length of the series must equal the rank of the array.
> > #|
>
> Do you mean |# here
yes I did mean |#
thanks
From: lin8080
Subject: Re: Multidimensional array storage referred to as "index sets" in spec
Date:
Message-ID: <47606319.7A08D0A6@freenet.de>
"metaperl.com" schrieb:
Maybe I'm wrong in understanding.
See also the comments in the source code. (here type.lisp from cl)
;; HyperSpec/Body/typspe_values.html indicates that VALUES means
;; EXACT-VALUES; however, HyperSpec/Body/speope_the.html indicates that
;; VALUES means ASSIGNABLE-VALUES.
Can't run your example:
(format t "~%~2d : ~A,~A,~A"
There is no [~] sign available to type in the interpreter window. The
key combination [alt] + [+] makes A to a. (using win98, cl243)
copy&paste does not work :(