Strict function
Encyclopedia
A strict function in the denotational semantics
Denotational semantics
In computer science, denotational semantics is an approach to formalizing the meanings of programming languages by constructing mathematical objects which describe the meanings of expressions from the languages...

 of programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

s is a function
Function (mathematics)
In mathematics, a function associates one quantity, the argument of the function, also known as the input, with another quantity, the value of the function, also known as the output. A function assigns exactly one output to each input. The argument and the value may be real numbers, but they can...

 f where . The entity , called bottom, denotes an expression which does not return a normal value, either because it loops endlessly or because it aborts due to an error such as division by zero. A function which is not strict is called non-strict. A strict programming language
Strict programming language
A strict programming language is one in which only strict functions may be defined by the user. A non-strict programming language allows the user to define non-strict functions, and hence may allow lazy evaluation.- Examples :Nearly all programming languages in common use today are strict...

 is one in which user-defined functions are always strict.

Intuitively, non-strict functions correspond to control structures. Operationally, a strict function is one which always evaluates its argument
Parameter
Parameter from Ancient Greek παρά also “para” meaning “beside, subsidiary” and μέτρον also “metron” meaning “measure”, can be interpreted in mathematics, logic, linguistics, environmental science and other disciplines....

, a non-strict function is one which may not evaluate some of its arguments. Functions having more than one parameter may be strict or non-strict in each parameter independently, as well as jointly strict in several parameters simultaneously.

As an example, the if-then-else expression of many programming languages may be thought of as a function of three parameters. This function is strict in its first parameter, since the function must know whether its first argument evaluates to true or to false before it can return; but it is non-strict in its second parameter, because (for example) if(false,,1) = 1, as well as non-strict in its third parameter, because (for example) if(true,2,) = 2. However, it is jointly strict in its second and third parameters, since if(true,,) = and if(false,,) = .
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK