fbpx
Wikipedia

Strict function

In computer science and computer programming, 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 . The entity , called 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 structures. Operationally, a strict function is one that always evaluates its 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 if-then-else expression of many programming languages, called ?: 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) 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,,) = .

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 a more efficient calling convention, such as call by value, without changing the meaning of the enclosing program.

See also edit

References edit

  1. ^ "A Gentle Introduction to Haskell: Functions". www.haskell.org. Retrieved 2016-06-23.

strict, function, this, article, needs, additional, citations, verification, please, help, improve, this, article, adding, citations, reliable, sources, unsourced, material, challenged, removed, find, sources, news, newspapers, books, scholar, jstor, july, 201. This article needs additional citations for verification Please help improve this article by adding citations to reliable sources Unsourced material may be challenged and removed Find sources Strict function news newspapers books scholar JSTOR July 2016 Learn how and when to remove this template message In computer science and computer programming 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 f displaystyle f left perp right perp The entity displaystyle perp called 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 structures Operationally a strict function is one that always evaluates its 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 if then else expression of many programming languages called a href 3F html class mw redirect title a 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 if false span class mwe math element span class mwe math mathml inline mwe math mathml a11y style display none math xmlns http www w3 org 1998 Math MathML alttext displaystyle perp semantics mrow class MJX TeXAtom ORD mstyle displaystyle true scriptlevel 0 mo mo mstyle mrow annotation encoding application x tex displaystyle perp annotation semantics math span span 1 1 as well as non strict in its third parameter because for example if true 2 span class mwe math element span class mwe math mathml inline mwe math mathml a11y style display none math xmlns http www w3 org 1998 Math MathML alttext displaystyle perp semantics mrow class MJX TeXAtom ORD mstyle displaystyle true scriptlevel 0 mo mo mstyle mrow annotation encoding application x tex displaystyle perp annotation semantics math span span 2 However it is jointly strict in its second and third parameters since if true span class mwe math element span class mwe math mathml inline mwe math mathml a11y style display none math xmlns http www w3 org 1998 Math MathML alttext displaystyle perp semantics mrow class MJX TeXAtom ORD mstyle displaystyle true scriptlevel 0 mo mo mstyle mrow annotation encoding application x tex displaystyle perp annotation semantics math span span span class mwe math element span class mwe math mathml inline mwe math mathml a11y style display none math xmlns http www w3 org 1998 Math MathML alttext displaystyle perp semantics mrow class MJX TeXAtom ORD mstyle displaystyle true scriptlevel 0 mo mo mstyle mrow annotation encoding application x tex displaystyle perp annotation semantics math span span span class mwe math element span class mwe math mathml inline mwe math mathml a11y style display none math xmlns http www w3 org 1998 Math MathML alttext displaystyle perp semantics mrow class MJX TeXAtom ORD mstyle displaystyle true scriptlevel 0 mo mo mstyle mrow annotation encoding application x tex displaystyle perp annotation semantics math span span and if false span class mwe math element span class mwe math mathml inline mwe math mathml a11y style display none math xmlns http www w3 org 1998 Math MathML alttext displaystyle perp semantics mrow class MJX TeXAtom ORD mstyle displaystyle true scriptlevel 0 mo mo mstyle mrow annotation encoding application x tex displaystyle perp annotation semantics math span span span class mwe math element span class mwe math mathml inline mwe math mathml a11y style display none math xmlns http www w3 org 1998 Math MathML alttext displaystyle perp semantics mrow class MJX TeXAtom ORD mstyle displaystyle true scriptlevel 0 mo mo mstyle mrow annotation encoding application x tex displaystyle perp annotation semantics math span span span class mwe math element span class mwe math mathml inline mwe math mathml a11y style display none math xmlns http www w3 org 1998 Math MathML alttext displaystyle perp semantics mrow class MJX TeXAtom ORD mstyle displaystyle true scriptlevel 0 mo mo mstyle mrow annotation encoding application x tex displaystyle perp annotation semantics math span span 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 a more efficient calling convention such as call by value without changing the meaning of the enclosing program See also editEager evaluation Lazy evaluation Short circuit evaluationReferences edit A Gentle Introduction to Haskell Functions www haskell org Retrieved 2016 06 23 Retrieved from https en wikipedia org w index php title Strict function amp oldid 985184858, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.