|
|
So, I was working on a bit of code, it was late, and I thought perhaps that
mod() would take a negative number and wrap it around to the "top", but it of
course does not. Then I got a "negative subscript" error when trying to address
an array element.
I was wondering if it might be sufficiently helpful so as to warrant an array
type that would automatically wrap in either direction - perhaps with a warning
that could be disabled.
So an array with 5 elements (#declare array = array [5]) would yield Array[0] if
Array[5] were addressed. And likewise Array[-1] would yield Array [4].
Something like carray for "cyclic array" or marray for "modulo array"...
Perhaps a spiral array would find use in navigating data as well - a 2
dimensional array where overrun in either direction in one dimension would shift
over to the edge element in the next dimension.
Post a reply to this message
|
|