In computer programming, a pure function is a function that has the following properties:

  1. the function return values are identical for identical arguments (no variation with local static variables, non-local variables, mutable reference arguments or input streams), and
  2. the function application has no side effects (no mutation of local static variables, non-local variables, mutable reference arguments or input/output streams).

Thus a pure function is a computational analogue of a mathematical function. Some authors, particularly from the imperative language community, use the term “pure” for all functions that just have the above property 2.

(“Pure Function” 2022)

References

“Pure Function.” 2022. Wikipedia, January. https://en.wikipedia.org/w/index.php?title=Pure_function&oldid=1065003790.

Backlinks