TL; DR
This is great to rely on scope in FP code.
Invariance means that something represented by a name cannot change its meaning. However, I would not call this the βprincipleβ of functional programming.
In any case, this is not at all related to the definition of a region. Passing things as arguments makes sense if you want to parameterize a function by another function - essentially making it a higher order function. A good example of this is fold (also known as reduce ), but map also one.
In your case, the alterData function alterData not add much value. map ping is something so common over something that it is usually better to provide only a singleton function, since it is, in principle, more reusable.
If you went doThing to alterData , you will make this function useless; why would i use it if i could just use map ? However, packaging an operation along with a display can sometimes be a useful abstraction.
Bartek banachewicz
source share