A function partial application has the form of a function call with certain formal parameters bound to expressions. A function partial application returns a partially evaluated function that is also a function, with the remaining not bound formal parameters still present in the same order as in the original function declaration. A function partial application is specified by the function keyword followed by a function call to func_name giving named formal parameter associations for the formal parameters to be bound:
function func_name(..., formal_parameter_name = expr, ...)
Note that the keyword function in a function partial application differentiates the syntax from a normal function call where some parameters have been left out and instead are supplied via default values.
The function created by the function partial application acts as the original function but with the bound formal input parameters(s) removed, i.e., they cannot be supplied arguments at function call. The binding occurs when the partially evaluated function is created. A partially evaluated function is type compatible (see section 6.5) to the same function with all bound arguments removed.
The following examples show a function partial application function Sine(A=2,w=3) with the two extra arguments A and w bound and thus eliminated, i.e., the resulting function is type compatible to Integrand with only formal parameters x and y left. The first example below, QuadratureSine1, has a call with a named input argument.
Instead of repeating the declaration of input formal parameter x and output formal parameter y, they can be inherited from Integrand, which is fine despite A and w now being at the end of the parameter list:
The second example, QuadratureSine2, shows a function partial application being passed as a positional argument. The numeric approximation of the integral will be better since a number of calls to quadrature on many short intervals are summed. The quadrature approximation that the integrated function is a straight line is typically more true over a short interval.
Below is an example of a function partial application of the function SurfaceIntegrand which is an instance called in the function surfaceQuadrature