I am confused by why Mathematica uses
[] to get the 3rd element, or
[[i,j] to get the i,j-th element of a 2D array.
This seems counter-intuitive. Is this main reason for this to separate array-indexing from function calls?
i.e. where I see:
f[3, 4] <-- this is currently function call f[[3, 4]] <-- f is a 2D array, and we're accessing 3,4-th element
Given that Mathematica knows the type of the arguments, can't it infer:
- if we're dealing with a function, apply arguments
if the object is an array, index it?
Thus, why do we need separate
[[ ]]notation for array indexing?