Multi-Dimensional Arrays in SPIN?
SPIN Gurus -
We've already established that SPIN supports arrays, but does it support multi-dimensional arrays? That would certainly give it quite a bit of added "punch" if it does, even at a minimalist level. What I mean by that is no dynamic arrays (although that would be SUPER!), and (say) limited to two or three dimensions.
TIA
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
We've already established that SPIN supports arrays, but does it support multi-dimensional arrays? That would certainly give it quite a bit of added "punch" if it does, even at a minimalist level. What I mean by that is no dynamic arrays (although that would be SUPER!), and (say) limited to two or three dimensions.
TIA
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Comments
There are two ways to do multidimensional arrays in Spin:
1. Simulate it via a single dimension: x[noparse][[/noparse]j][noparse][[/noparse]k] == x[noparse][[/noparse]j * n + k], where n is the size of the "k" dimension.
2. Use pointers: word[noparse]/noparse]x[noparse][[/noparse]j[noparse][[/noparse]k], where x[noparse][[/noparse]j] points to another array, which is indexed by k.
BTW, I've written a heap manager for dynamic allocation. It's written in Spin and is still in beta testing.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Just tossing my two bits worth into the bit bucket
KK
·