The iota-sum idiom optimisation is skipping type checks and returning 0 instead of throwing an error for a negative argument
iota-sum declares the type of n to be (integer 0 10000000), but this isn't being checked (probably because of speed 3, safety 0)
doing ⍳¯5 throws a type-error, but this is all the way in make-array when binding SB-VM::DIMENSIONS
When doing either of the above, Dyalog simply says:
DOMAIN ERROR
Suggest that both iota-sum and count-to explicitly check for negative argument and adjust the error message (adding it to iota-sum):
"The argument to [⍳ index] must be a positive integer, i.e. ⍳9, or a vector, i.e. ⍳2 3."
The
iota-sum
idiom optimisation is skipping type checks and returning 0 instead of throwing an error for a negative argumentiota-sum
declares the type ofn
to be(integer 0 10000000)
, but this isn't being checked (probably because ofspeed 3
,safety 0
) doing⍳¯5
throws a type-error, but this is all the way inmake-array
when bindingSB-VM::DIMENSIONS
When doing either of the above, Dyalog simply says:
DOMAIN ERROR
Suggest that both
iota-sum
andcount-to
explicitly check for negative argument and adjust the error message (adding it to iota-sum): "The argument to [⍳ index] must be a positive integer, i.e. ⍳9, or a vector, i.e. ⍳2 3."