Pure function
Appearance
A function is pure if it returns the same output on the same input. This is a component of referential transparency.
Examples of pure functions
Arithmetic functions are pure, and they are the archetype.
Examples of impure functions
today() is impure, as at different times it will yield different results: it refers to some global state.
Similarly, any function that uses global state or a static variable is potentially impure.
random() is impure, as each call potentially yields a different value.