26
loading...
This website collects cookies to deliver better user experience
The output of a pure function depends only on its input parameters and its internal algorithm (i.e. the “black box” where the input parameters are fed into).
A pure function has no side effects ; it does not have any read/write interactions with the outside world.
As a consequence of the above two statements, if a pure function is called with an input parameter x infinite number of times, it will always return the same result y - regardless of any state change of an internal or external process.
An expression e
is referentially transparent if, for all programs p
, all occurrences of e
in p
can be replaced by the result of evaluating e
without affecting the meaning of p
.