Re: Partial function application (Currying)

2024-01-20 Thread atzensepp via Digitalmars-d-learn
On Saturday, 20 January 2024 at 20:58:49 UTC, Richard (Rikki) Andrew Cattermole wrote: On 21/01/2024 9:55 AM, atzensepp wrote: import std.stdio; // Overloads are resolved when the partially applied function is called // with the remaining arguments. struct S { static char fun(int i, string s) {

Re: Partial function application (Currying)

2024-01-20 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 21/01/2024 9:55 AM, atzensepp wrote: import std.stdio; // Overloads are resolved when the partially applied function is called // with the remaining arguments. struct S { static char fun(int i, string s) { return s[i]; } static int fun(int a, int b) { return a * b; } } void main() { alias fu

Re: Partial function application (Currying)

2024-01-20 Thread atzensepp via Digitalmars-d-learn
On Saturday, 20 January 2024 at 17:47:29 UTC, Richard (Rikki) Andrew Cattermole wrote: Not really any other way to do it, create context (i.e. struct, or stack) and have a delegate point to both it and a patch function. It'll be how partial is implemented. https://dlang.org/phobos/std_functio

Re: Partial function application (Currying)

2024-01-20 Thread atzensepp via Digitalmars-d-learn
On Saturday, 20 January 2024 at 17:45:36 UTC, Christian Köstlin wrote: Would https://dlang.org/library/std/functional/curry.html help you? kind regards, Christian Hello Christian, thank for the link. I looks good however in my installation (gdc 8.4.0) it says: ```d curry.d:1:8: error: modul

Re: Partial function application (Currying)

2024-01-20 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Not really any other way to do it, create context (i.e. struct, or stack) and have a delegate point to both it and a patch function. It'll be how partial is implemented. https://dlang.org/phobos/std_functional.html#.partial

Re: Partial function application (Currying)

2024-01-20 Thread Christian Köstlin via Digitalmars-d-learn
Would https://dlang.org/library/std/functional/curry.html help you? kind regards, Christian