Pure Expressions
Pure functions are required to construct pure expressions. Constant expressions are pure by definition. An expression consisting of a function subexpression applied to one or more argument subexpressions is pure if both these statements about the subexpressions hold:
- The function and argument subexpressions are pure expressions.
- The function subexpression yields a pure function.
Typically the function subexpression is simply a function identifier. Pure expressions are often referred to as being referentially transparent.
Evaluation of a given pure expression will yield the same result regardless of when or how many times evaluation occurs during program execution. This property is what makes it meaningful to talk about an expression's "value". It also makes it possible to replace an expression with the corresponding value (or it with an equivalent alternative expression) without changing the meaning of a program.
Read more about this topic: Pure Function
Famous quotes containing the words pure and/or expressions:
“Physical pleasure is a sensual experience no different from pure seeing or the pure sensation with which a fine fruit fills the tongue; it is a great unending experience, which is given us, a knowing of the world, the fullness and the glory of all knowing. And not our acceptance of it is bad; the bad thing is that most people misuse and squander this experience and apply it as a stimulant at the tired spots of their lives and as distraction instead of a rallying toward exalted moments.”
—Rainer Maria Rilke (18751926)
“Let it be signified to me through any channel ... that the possession of the Floridas would be desirable to the United States, and in sixty days it will be accomplished.
...penned in the language of truth, and divested of those expressions of servility which would persuade his majesty that we are asking favors and not rights.”
—Thomas Jefferson (17431826)