Re: Partial application on Nth argument

2024-12-05 Thread monkyyy via Digitalmars-d-learn
On Thursday, 5 December 2024 at 21:14:32 UTC, Salih Dincer wrote: static if unnecessary, check mine

Re: Partial application on Nth argument

2024-12-05 Thread Salih Dincer via Digitalmars-d-learn
On Wednesday, 4 December 2024 at 21:33:46 UTC, Salih Dincer wrote: Maybe I'm misunderstanding... Now I get it! In fact, we bind a chosen argument. This reveals the inadequacy of the name chosen for the library. I've made it better by adding a few lines of code: ```d auto hello(T)(T a, T b,

Re: Partial application on Nth argument

2024-12-04 Thread Salih Dincer via Digitalmars-d-learn
On Wednesday, 4 December 2024 at 08:50:21 UTC, axricard wrote: 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

Re: Partial application on Nth argument

2024-12-04 Thread monkyyy via Digitalmars-d-learn
On Wednesday, 4 December 2024 at 08:50:21 UTC, axricard wrote: 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

Partial application on Nth argument

2024-12-04 Thread axricard via Digitalmars-d-learn
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!(fu