Related to this, fill-int-range! iterates over the proper length of the array, resulting in an array bounds condition on SBCL 2.0.1 if I recompile the function without the #.no-bounds-checks declaration. I think it without bounds checks it just overflows the array.
Sorry if this is a bit terse, I'm pressed for time and wanted to get this written before I forgot. If I'm mistaken about something just let me know.
Expected:
(range -2 5 2) => #(-2 0 2 4)
Actual:(range -2 5 2) => #(-2 0 2)
The length is calcuated by
int-range-shape
, on line 127 ofrange.lisp
in alet
binding:(len (abs (truncate (- high low) step)))
If
(mod (- high low) step)
is not zero we end up one short in our calculation of the range's number of elements.While I haven't exhaustively tested it, the following snippet seems to correctly calculate the length:
Related to this,
fill-int-range!
iterates over the proper length of the array, resulting in an array bounds condition on SBCL 2.0.1 if I recompile the function without the#.no-bounds-checks
declaration. I think it without bounds checks it just overflows the array.