Partial Application
Partial application fixes part or all of the parameters of a function to generate a new function with fewer parameters.
Syntax
<functionName>{parameters}
Details
To fix the first few parameters, we do not need to indicate the remaining parameters; if there are any free parameters before a fixed parameter, the positions of these free parameters must be indicated. Please refer to the examples below.
Partial application can be used with template functions that have certain requirements about function inputs.
Examples
$ a=100
$ g=add{a*a};
$ g(8);
10008
$ add{a*a}(88);
10088
$ def f(a,b):a*exp(b)
$ g=f{10}; // g(b)==f(10,b)
$ g(0);
10
$ g(1);
27.182818
$ k=f{,1}; // k(a)==f(a,1)
$ k(10);
27.182818