Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Strict function
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Refimprove|date=July 2016}} In [[computer science]] and [[computer programming]], a [[function (computer programming)|function]] f is said to be '''strict''' if, when applied to a non-terminating expression, it also fails to terminate.<ref>{{Cite web|url=https://www.haskell.org/tutorial/functions.html|title=A Gentle Introduction to Haskell: Functions|website=www.haskell.org|access-date=2016-06-23}}</ref> A '''strict function''' in the [[denotational semantics]] of [[programming language]]s is a [[function (mathematics)|function]] ''f'' where <math>f\left(\perp\right) = \perp</math>. The entity <math>\perp</math>, called ''[[Bottom type|bottom]]'', denotes an expression that 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 that 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 structure]]s. Operationally, a strict function is one that always [[evaluate]]s its [[parameter|argument]]; a non-strict function is one that might not evaluate some of its arguments. Functions having more than one parameter can be strict or non-strict in each parameter independently, as well as ''jointly strict'' in several parameters simultaneously. As an example, the <code>if-then-else</code> expression of many programming languages, called <code>[[?:]]</code> in languages inspired by C, 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) <code>if(false,<math>\perp</math>,1) = 1</code>, as well as non-strict in its third parameter, because (for example) <code>if(true,2,<math>\perp</math>) = 2</code>. However, it is jointly strict in its second and third parameters, since <code>if(true,<math>\perp</math>,<math>\perp</math>) = <math>\perp</math></code> and <code>if(false,<math>\perp</math>,<math>\perp</math>) = <math>\perp</math></code>. In a [[non-strict programming language|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 [[compilation (programming)|compiled]] to a more efficient [[calling convention]], such as [[call by value]], without changing the meaning of the enclosing program.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)