[cdr-discuss] CDR 5

I haven't looked over all the details but this seems like a very good idea to me and also seems clear, to the point and precise. nice work, -- Gary Warren King, metabang.com Cell: (413) 559 8738 Fax: (206) 338-4052 gwkkwg on Skype * garethsan on AIM

The ARRAY-INDEX definition seems slightly suspect -- I believe it should be: (deftype array-index () `(integer 0 (,(1- array-dimension-limit)))) Cheers, -- Nikodemus

Hi It may, but I find it debatable. There is no stating in the ANSI spec that ARRAY-DIMENSION-LIMIT = or / = or < or <= ARRAY-TOTAL-SIZE-LIMIT. AFAIU, the latter is guaranteed to be the maximum number of elements in an array as per the glossary entry about "array total size" (always implementation dependent). This will warrant things like (defvar a (make-array (list d1 d2 ... dn))) (defvar da (make-array (reduce '* (array-dimensions a)) :displaced- to a)) ;;; looping over da My gut feeling is that this is a foggy corner of the ANSI spec. Given the above example, I would surmise that ARRAY-DIMENSION-LIMIT = ARRAY-TOTAL-SIZE-LIMIT is implied by the ANSI spec, but that may or may not be the case. The real issue I am not sure about is whether to include or not the limit. It has been known for DOTIMES to expand in such a way to make the counter (at least internally) reach the limit. In any case that was my unstated rationale for the definition. If people are more confortable using ARRAY-DIMENSION-LIMIT. In this case, I think the definition should look like (deftype array-index () `(integer 0 (,array-dimension-limit))) as A-D-L is already the upper exclusive limit. Cheers Marco On Feb 28, 2008, at 12:09 , Nikodemus Siivola wrote:
The ARRAY-INDEX definition seems slightly suspect -- I believe it should be:
(deftype array-index () `(integer 0 (,(1- array-dimension-limit))))
Cheers,
-- Nikodemus _______________________________________________ cdr-discuss mailing list cdr-discuss@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cdr-discuss
-- Marco Antoniotti

Actually the example may not be all that appropriate. In any case, that were my considerations. Do let me know if there is a strong preference versus A-D-L or otherwise. Also let me hear your thoughts about including or not the upper limit. Cheers Marco On Feb 29, 2008, at 11:52 , Marco Antoniotti wrote:
Hi
It may, but I find it debatable.
There is no stating in the ANSI spec that ARRAY-DIMENSION-LIMIT = or /= or < or <= ARRAY-TOTAL-SIZE-LIMIT. AFAIU, the latter is guaranteed to be the maximum number of elements in an array as per the glossary entry about "array total size" (always implementation dependent). This will warrant things like
(defvar a (make-array (list d1 d2 ... dn)))
(defvar da (make-array (reduce '* (array-dimensions a)) :displaced- to a))
;;; looping over da
My gut feeling is that this is a foggy corner of the ANSI spec. Given the above example, I would surmise that ARRAY-DIMENSION-LIMIT = ARRAY-TOTAL-SIZE-LIMIT is implied by the ANSI spec, but that may or may not be the case.
The real issue I am not sure about is whether to include or not the limit. It has been known for DOTIMES to expand in such a way to make the counter (at least internally) reach the limit.
In any case that was my unstated rationale for the definition. If people are more confortable using ARRAY-DIMENSION-LIMIT. In this case, I think the definition should look like
(deftype array-index () `(integer 0 (,array-dimension-limit)))
as A-D-L is already the upper exclusive limit.
Cheers
Marco
On Feb 28, 2008, at 12:09 , Nikodemus Siivola wrote:
The ARRAY-INDEX definition seems slightly suspect -- I believe it should be:
(deftype array-index () `(integer 0 (,(1- array-dimension-limit))))
Cheers,
-- Nikodemus _______________________________________________ cdr-discuss mailing list cdr-discuss@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cdr-discuss
-- Marco Antoniotti
_______________________________________________ cdr-discuss mailing list cdr-discuss@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cdr-discuss
-- Marco Antoniotti

Marco, Minor points: 1. I found the title of this CDR uninformative. Would you consider replacing the word "extra" with "sub-interval"? 2. Minor typo (missing word) in 2nd para of introduction: "a brief discussion pertaining TO the rationale..." 3. I'm not comfortable with the abbreviations in section 3 - as you say it's not like CL has a tradition of abbreviating like this. - nick

On 2/29/08, Marco Antoniotti <marcoxa@cs.nyu.edu> wrote:
There is no stating in the ANSI spec that ARRAY-DIMENSION-LIMIT = or / = or < or <= ARRAY-TOTAL-SIZE-LIMIT. AFAIU, the latter is guaranteed to be the maximum number of elements in an array as per the glossary entry about "array total size" (always implementation dependent).
From the ARRAY-TOTAL-SIZE-LIMIT dictionary entry:
"The actual limit on the array total size imposed by the implementation might vary according the element type of the array; in this case, the value of array-total-size-limit will be the smallest of these possible limits." which IMO makes it unsuitable for this type. ARRAY-DIMENSION-LIMIT OTOH doesn't carry these weasel-words, which in my interpretation means that it is the greatest of the possible limits. (But the distinction is somewhat academic, I grant you. In eg. SBCL both A-D-L and A-T-S-L are MOST-POSITIVE-FIXNUM, though arguably at least A-T-S-L should be smaller then that.)
The real issue I am not sure about is whether to include or not the limit. It has been known for DOTIMES to expand in such a way to make the counter (at least internally) reach the limit.
In that I would prefer another name -- since ARRAY-INDEX is not a descriptive one anymore. ARRAY-DIMENSION would be more correct then.
In any case that was my unstated rationale for the definition. If people are more confortable using ARRAY-DIMENSION-LIMIT. In this case, I think the definition should look like
(deftype array-index () `(integer 0 (,array-dimension-limit)))
as A-D-L is already the upper exclusive limit.
...for dimension, not index. :) Cheers, -- Nikodemus

On Mar 1, 2008, at 14:21 , Nikodemus Siivola wrote:
On 2/29/08, Marco Antoniotti <marcoxa@cs.nyu.edu> wrote:
There is no stating in the ANSI spec that ARRAY-DIMENSION-LIMIT = or / = or < or <= ARRAY-TOTAL-SIZE-LIMIT. AFAIU, the latter is guaranteed to be the maximum number of elements in an array as per the glossary entry about "array total size" (always implementation dependent).
From the ARRAY-TOTAL-SIZE-LIMIT dictionary entry:
"The actual limit on the array total size imposed by the implementation might vary according the element type of the array; in this case, the value of array-total-size-limit will be the smallest of these possible limits."
which IMO makes it unsuitable for this type. ARRAY-DIMENSION-LIMIT OTOH doesn't carry these weasel-words, which in my interpretation means that it is the greatest of the possible limits.
Well, this is why using A-T-S-L is the most conservative choice. The main difference is in the glossary entry for array total size.
(But the distinction is somewhat academic, I grant you. In eg. SBCL both A-D-L and A-T-S-L are MOST-POSITIVE-FIXNUM, though arguably at least A-T-S-L should be smaller then that.)
Yes. Maybe, the index type should be parametric on the element type.
The real issue I am not sure about is whether to include or not the limit. It has been known for DOTIMES to expand in such a way to make the counter (at least internally) reach the limit.
In that I would prefer another name -- since ARRAY-INDEX is not a descriptive one anymore. ARRAY-DIMENSION would be more correct then.
Sounds good to me.
In any case that was my unstated rationale for the definition. If people are more confortable using ARRAY-DIMENSION-LIMIT. In this case, I think the definition should look like
(deftype array-index () `(integer 0 (,array-dimension-limit)))
as A-D-L is already the upper exclusive limit.
...for dimension, not index. :)
Ok as well. Cheers -- Marco Antoniotti
participants (4)
-
Gary King
-
Marco Antoniotti
-
Nick Levine
-
Nikodemus Siivola