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:
“It is with unfathomable love, pure joy and no regret that we leave this world. Men, do not cry for our fate, but cry for your own.”
—Members of the Order of the Solar T.. New York Times, p. 1 (October l4, 1994)
“We ought to celebrate this hour by expressions of manly joy. Not thanks, not prayer seem quite the highest or truest name for our communication with the infinite,but glad and conspiring reception,reception that becomes giving in its turn, as the receiver is only the All-Giver in part and infancy.”
—Ralph Waldo Emerson (18031882)