Partial application on Nth argument

axricard axelrwiko at gmail.com
Wed Dec 4 08:50:21 UTC 2024


Hello

I believe std.functional.partial can only apply to the first 
argument.
Is there an equivalent for the Nth argument ?

Something like :

``` D
int fun(int a, int b) { return a - b; }

// create a function with the argument n°1 being equal to 5
// fun5 = fun(a, 5);
alias fun5 = partialN!(fun, 1, 5);
writeln(fun5(7)); // print 2
```


More information about the Digitalmars-d-learn mailing list