4 ms·
Are these languages pure in the functional sense? E.g. Do they allow/encourage mutation? My understanding is that APL permits mutable state and side effects, bu
by munchler 1y ago
Are these languages pure in the functional sense? E.g. Do they allow/encourage mutation? My understanding is that APL permits mutable state and side effects, but maybe they are rarely used in practice? If you're modifying the contents of an array in-place, I don't think it's reasonable to consider that functional.
- RodgerTheGreat 1y agoAPL arrays are values in the same sense as value types in any functional language. You don't explicitly modify arrays in-place; if they happen to have a refcount of 1 operations may happen in-place as an optimization, but not in a manner which observably alters program behavior.
- zfnmxt 1y agoFuthark, SaC, and Accelerate have purely functional semantics. Futhark has something called "in-place updates" that operationally mutate the given array, but semantically they work as if a new array is created (and are statically guaranteed to work this way by the type system).
- grg0 1y agoAccelerate is a Haskell library/eDSL.
- axman6 1y agoI wasn’t expecting to personally know two of the authors, but having Accelerate included makes sense.
- geocar 1y ago> My understanding is that APL permits mutable state and side effects ... If you're modifying the contents of an array in-place, I don't think it's reasonable to consider that functional. a←'hello' a[1]←'c' This does _not_ modify the array in-place. It's actually the same as: a←'hello' a←'c'@1⊢a which is more obviously functional. It is easy to convince yourself of this: a←'hello' b←a b[1]←'j' a,b returns 'hellojello' and not 'jellojello'.