Are Arrays Functions?
20 days ago
- #programming
- #arrays
- #functions
- Haskell documentation describes arrays as functions with domains isomorphic to contiguous subsets of integers.
- Language designers consider unifying arrays and functions at syntax or type level for language improvement.
- K language syntactically unifies arrays and functions but lacks type system support.
- Dex research language conceptualizes arrays and functions similarly but keeps them as distinct types.
- Common function operations like currying and flipping have array equivalents like unflattening and transposing.
- Futhark cannot unify arrays and functions at type level due to defunctionalization restrictions.
- Futhark's array slicing syntax poses challenges for unification with function application.
- Proposal to allow array application to index arrays for slicing, but operational guarantees are tricky.
- Interest in exploring shared abstractions for arrays and functions in future languages.
- Potential for extending AUTOMAP to AUTOFMAP for operations on functions with same domain.