3 ms·
No, not in a programming language sense, because arrays are a notation for address offsetting, whereas functions change the execution context of the machine, wh
by riazrizvi 9mo ago
No, not in a programming language sense, because arrays are a notation for address offsetting, whereas functions change the execution context of the machine, which is critical to processing performance (think Horner's method).
Not even in a functional sense because, even though functions are input-output maps we define, the inputs are dimensionally rich, it's nowhere close to equivalent to jerry rig a contiguous input space for that purpose.
- marcosdumay 9mo ago> the inputs are dimensionally rich Well, that makes arrays a subset of functions. What is still a "yes" to the questions "are arrays functions?" And yeah, of course the article names Haskell on its second phrase.
- gf000 9mo ago> arrays are a notation for address offsetting That's an implementation detail, though.
- riazrizvi 9mo agoNo, not when you're designing processes based on a Von Neumann (sequential RAM) architecture. This is the characteristic feature of what the 'array tool' represents.
- Athas 9mo agoThat depends on the language. I have used (and implemented) languages where arrays are modeled as a function from an index space to some expression. During compilation, this is used to drive various optimisations. For those arrays that need a run-time representation, they may be stored in the classic way (a dense region of memory accessed with offsets computed from indexes), but also in more complicated ways, such as some kind of tree structure. These are still, semantically, arrays at the language level.
- themafia 9mo agoIt reminds me of a saying I heard from an Italian: "...and if my Grandmother had wheels she would have been a bike."