Associative indexing
Associative indexing
Most contemporary language have associative indexing because most applications need it in some way or some other : we live in a world of tags as much as in a world of numbers. So in Perl or PHP you can index any array with a key instead of just an integer (Perl needs to introduce {} for associative arrays, but PHP does not).
While allowing A['Jones' 'Smith' 'Martin'] just as well as A[1 3 2] would ask for some further definition of what the monadic rho function returns for such arrays, I have the feeling any syntax extension would have no effect at all on existing programs using only integer indexing. What would be needed in the implementation is just an additional 2-bit type in the descriptor telling if the corresponding variable is indexed
- just numerically
- just alphamerically
- mixed
In the case of arrays of arrays, of course, that would need further definition, though each array in the description has it own descriptor too.
That is juste a "partly-baked idea", not an implementation proposal yet, much less a contribution to the code (I only arrived today ans have not looked to the code yet); but just imagine how writing agile applications in APL (or NARS) would be easier to use with this associative indexing facility.
Back to Project ideas