Function application
Encyclopedia
In mathematics, function application is the act of applying a function
to an argument from its domain
so as to obtain the corresponding value from its range
.
In some instances, a different notation is used where the parentheses aren't required, and function application can be expressed just by juxtaposition. For example, the following expression can be considered the same as the previous one:
The latter notation is especially useful in combination with the currying
isomorphism. Given a function , its application is represented as by the former notation and by the latter. However, functions in curried form can be represented by juxtaposing their arguments: , rather than . This relies on function application being left-associative.
or , by the following definition:
The operator may also be denoted by a backtick (`).
If the operator is understood to be of low precedence
and right-associative, the application operator can be used to cut down on the number of parentheses needed in an expression. For example;
can be rewritten as:
However, this is perhaps more clearly expressed by using function composition
instead:
is expressed by β-reduction.
The Curry-Howard correspondence relates function application to the logical rule of modus ponens
.
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...
to an argument from its domain
Domain (mathematics)
In mathematics, the domain of definition or simply the domain of a function is the set of "input" or argument values for which the function is defined...
so as to obtain the corresponding value from its range
Range (mathematics)
In mathematics, the range of a function refers to either the codomain or the image of the function, depending upon usage. This ambiguity is illustrated by the function f that maps real numbers to real numbers with f = x^2. Some books say that range of this function is its codomain, the set of all...
.
Representation
Function application is usually depicted by juxtaposing the variable representing the function with its argument encompassed in parentheses. For example, the following expression represents the application of the function ƒ to its argument x.In some instances, a different notation is used where the parentheses aren't required, and function application can be expressed just by juxtaposition. For example, the following expression can be considered the same as the previous one:
The latter notation is especially useful in combination with the currying
Currying
In mathematics and computer science, currying is the technique of transforming a function that takes multiple arguments in such a way that it can be called as a chain of functions each with a single argument...
isomorphism. Given a function , its application is represented as by the former notation and by the latter. However, functions in curried form can be represented by juxtaposing their arguments: , rather than . This relies on function application being left-associative.
As an operator
Function application can be trivially defined as an operator, called ApplyApply
In mathematics and computer science, Apply is a function that applies functions to arguments. It is central to programming languages derived from lambda calculus, such as LISP and Scheme, and also in functional languages...
or , by the following definition:
The operator may also be denoted by a backtick (`).
If the operator is understood to be of low precedence
Order of operations
In mathematics and computer programming, the order of operations is a rule used to clarify unambiguously which procedures should be performed first in a given mathematical expression....
and right-associative, the application operator can be used to cut down on the number of parentheses needed in an expression. For example;
can be rewritten as:
However, this is perhaps more clearly expressed by using function composition
Function composition
In mathematics, function composition is the application of one function to the results of another. For instance, the functions and can be composed by computing the output of g when it has an argument of f instead of x...
instead:
Other instances
Function application in the lambda calculusLambda calculus
In mathematical logic and computer science, lambda calculus, also written as λ-calculus, is a formal system for function definition, function application and recursion. The portion of lambda calculus relevant to computation is now called the untyped lambda calculus...
is expressed by β-reduction.
The Curry-Howard correspondence relates function application to the logical rule of modus ponens
Modus ponens
In classical logic, modus ponendo ponens or implication elimination is a valid, simple argument form. It is related to another valid form of argument, modus tollens. Both Modus Ponens and Modus Tollens can be mistakenly used when proving arguments...
.