The typical syntax for accessing an array (or list, map and similar data structures) at a specific index is a[i]. I believe C first introduced it as syntax sugar, though I wonder why it has stuck around when an alternative syntax could be a mere infix operator (something like a @ i), yielding back one precious pair of brackets for other use cases, such as generics (angle brackets knowingly being a hassle to parse).
This would intuitively make sense to me, as typically mixfix operators are rarely encountered otherwise in programming languages (exceptions being the function call and ternary operator). Yet I don't know a single language that would permit something along the lines of the following (Java-y):
// cities: Map<String, List<Inhabitant>>
cities @ cityName @ inhabitantIdx = new Inhabitant(...);
The only potential problem I can see is grouping (e.g., for accessing a member: (a @ i).field), though languages like Java already have a similar problem with the binary AND and OR operators (i.e. if ((field & mask) != 0) ...), and people get along with that just fine. What might then be the reason that programming languages throughout the spectrum have consequently stuck to this one single syntax for accessing arrays (AFAIK), when they're showing wild exploration in so many other areas?
arr.2for accessing the third element andarr.-1for accessing the last element, so you only need the bracket syntax for dynamically computed indices. $\endgroup$x@y@zbe parsed? Both(x@y)@z(two-dimensional array) andx@(y@z)(double indirection) are useful, and it's not intuitive to me which one should be preferred. They might even both be semantically valid if you have weak typing and associative arrays. On the other hand, mix-fix forces you to write eitherx[y][z]orx[y[z]]and there is no ambiguity. $\endgroup${0, ... n-1}(assuming zero-based). And function call syntax is ingrained from math, but I suppose it would likewise be interesting to ask what alternatives have been considered there. $\endgroup$_as a name for this infix operator. Though in math, typography helps distinguish between(a_i)_janda_(i_j), as the latter would have thejsmaller and placed vertically lower. $\endgroup$