In functional programming, we try to isolate pure functions from effectful functions. Functions are considered pure if the output of a function depends on its inputs only and if the invocation of such a function does not change anything outside the scope of the function itself
Data structures are considered immutable, i.e., instead of modifying a structure to change data, we create copies of that structure and apply the modifications to that copy.
Composition
When designing functions, we attempt to design them so the output of one function can be passed as an input to the next function, forming a new function.
If all functions in a composition are pure, then the result of the composition is pure, too, so we can derive more complex scenarios from simpler ones.