On 4/30/21 11:04 AM, John Cowan wrote:
> I don't understand your reasoning here.
Well, in three dimensions the general case is
(lambda (i j k)
(+ base
(* increment-0 (- i low-0))
(* increment-1 (- j low-1))
(* increment-2 (- k low-2))))
I guess what I call increments other people might call strides.
It could happen that an index and the associated increment and lower
bound are all fixnums, but the product of the increment and the lower
bound is a bignum. (It's not that hard on a 32-bit machine.)
The simplest case (base and all lower bounds are zero, the last
increment is 1) is simply
(lambda (i j k)
(+ (* increment-0 i)
(* increment-1 j)
k))
So the closure has only two elements and the common case is fast.
Brad