This page is part of the web mail archives of SRFI 25 from before July 7th, 2015. The new archives for SRFI 25 contain all messages, not just those from before July 7th, 2015.
Great SRFI!! However, if I can suggest to have a look at the library blitz++ : this is a template library in C++ (a bag of clever macros) which deals with arrays. They have defined some basic operations and others not so basic to deal with multi-dimensional arrays. Some concepts from this library : - represent the data as a linear vector - store shape information in some "vectors": - base vector : store the lower index in each dimension - length vector : store number of indices in each dimension - step vector : store the step size for each dimension - stride vector : store the product of the length of the dimension g - permutation vector : store if any permutation - a different object to reprensent shapes Hence, in order to acces the element (array-ref a 3 5 6), we compute : i = (3-base[permutation])/step[permutation]*stride[permutation] + (5-base[permutation])/step[permutation]*stride[permutation] + (6-base[permutation])/step[permutation]*stride[permutation] and give (vector-ref v i). In the SRFI-25 way of thinking, the analogies are: (shape a) = (base (+ base length) ... base[n] (+ base[n] length[n])) permutation = (0 1 ... n) (no permutation of indices) step = (1 1 ... 1) (indices increase only by 1) stride = (lentgh*...*length[n-1]*1 lentgh*...*length[n-1]*1 ... length[n-1]*1 1) Some advantages of the representation are: - the possibility to transpose arrays with no cost by doing: permutation = (1 0 2) instead of (0 1 2) - having steps (may be negative or positive) - representing slice (with affine maps) by playing only on "base","step" and "permutation" - shapes are not arrays, indices are not arrays because they both need more economic and efficient representations Well, I think it is worth the look. Maybe those ideas are only ideas for implementations but anyway, this is a srfI ! Moreover, this can be efficiently done (no vector nestings) and can be a great tool for numeric calculus (speed AND high level language!!!) Sebastien de Menten