3 ms·
One is looking up a value, while the other is (in most of these languages) executing a subroutine. While they are mathematically equivalent, in these languages
by ben509 7y ago
One is looking up a value, while the other is (in most of these languages) executing a subroutine.
While they are mathematically equivalent, in these languages they are doing different things. Function application and array access are two different concepts the symbols are trying to convey to a programmer.
This is why, e.g., in Haskell where a string is literally a list of characters, they nevertheless have a different syntax for the two.
- monocasa 7y agoI mean, Haskell literally defines array access in terms of a function. > Haskell provides indexable arrays, which may be thought of as functions whose domains are isomorphic to contiguous subsets of the integers. https://www.haskell.org/onlinereport/haskell2010/haskellch14.html https://www.haskell.org/onlinereport/haskell2010/haskellch14... The fact that strings are different seems to have more to do with the ergonomics of strings rather than arrays.