[Alexandria-devel] [PATCH] Fix default ARRAY-INDEX and ARRAY-LENGTH.

James M. Lawrence llmjjmll at gmail.com
Fri Jul 25 15:51:25 UTC 2014


ARRAY-DIMENSION-LIMIT is an exclusive upper bound.
---
 types.lisp |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/types.lisp b/types.lisp
index 6aa722f..1942d0e 100644
--- a/types.lisp
+++ b/types.lisp
@@ -1,14 +1,14 @@
 (in-package :alexandria)

-(deftype array-index (&optional (length array-dimension-limit))
+(deftype array-index (&optional (length (1- array-dimension-limit)))
   "Type designator for an index into array of LENGTH: an integer between
-0 (inclusive) and LENGTH (exclusive). LENGTH defaults to
+0 (inclusive) and LENGTH (exclusive). LENGTH defaults to one less than
 ARRAY-DIMENSION-LIMIT."
   `(integer 0 (,length)))

-(deftype array-length (&optional (length array-dimension-limit))
+(deftype array-length (&optional (length (1- array-dimension-limit)))
   "Type designator for a dimension of an array of LENGTH: an integer between
-0 (inclusive) and LENGTH (inclusive). LENGTH defaults to
+0 (inclusive) and LENGTH (inclusive). LENGTH defaults to one less than
 ARRAY-DIMENSION-LIMIT."
   `(integer 0 ,length))

-- 
1.7.9.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-default-ARRAY-INDEX-and-ARRAY-LENGTH.patch
Type: text/x-diff
Size: 1299 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/alexandria-devel/attachments/20140725/eac1e579/attachment.patch>


More information about the alexandria-devel mailing list