Opened 11 years ago
#348 new defect
REPLACE should throw an error when given negative indices
Reported by: | T.Y Chew | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | interpreter | Version: | 1.2.1 |
Keywords: | clhs | Cc: | |
Parent Tickets: |
Description
(let ((x (make-array 10 :initial-contents "abcdefghij"))
(y (make-array 10 :initial-contents "0123456789")))
(replace x y :start2 0 :end2 -8)
(list x y))
==>
(#(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)
#(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
The error messages (when we get them) could be quite confusing:
(let ((x (make-array 10 :initial-contents "abcdefghij"))
(y (make-array 10 :initial-contents "0123456789")))
(replace x y :start1 0 :end1 -1 :start2 0 :end2 -1)
(list x y))
signals:
Invalid array index 10 for #(0 1 2 3 4 5 6 7 8 9) (should be >= 0 and < 10).
[Condition of type TYPE-ERROR]
Note: See
TracTickets for help on using
tickets.