[cdr-discuss] CDR 5
Marco Antoniotti
marcoxa at cs.nyu.edu
Fri Feb 29 09:52:17 UTC 2008
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 at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cdr-discuss
--
Marco Antoniotti
More information about the cdr-discuss
mailing list