Pure Functions
Pure functions are arguably the essence of the functional programming paradigm. A function f
is pure if:
- The return values of the function are the same for the same arguments.
- The arguments are not modified.
- There is no use of variables outside the scope of
f
. - There are no side-effects, i.e. no mutation of variables outside the scope of
f
, no IO etc.