# Strict function

(Redirected from Non-strict)

A function f is said to be strict if, when applied to a non-terminating expression, it also fails to terminate.[1] A strict function in the denotational semantics of programming languages is a function f where ${\displaystyle f\left(\perp \right)=\perp }$. The entity ${\displaystyle \perp }$, 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 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; 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,${\displaystyle \perp }$,1) = 1, as well as non-strict in its third parameter, because (for example) if(true,2,${\displaystyle \perp }$) = 2. However, it is jointly strict in its second and third parameters, since if(true,${\displaystyle \perp }$,${\displaystyle \perp }$) = ${\displaystyle \perp }$ and if(false,${\displaystyle \perp }$,${\displaystyle \perp }$) = ${\displaystyle \perp }$.

In a non-strict functional programming language, strictness analysis refers to any algorithm used to prove the strictness of a function with respect to one or more of its arguments. Such functions can be compiled to use a more efficient[which?] calling convention without changing the meaning of the enclosing program.