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 fun3 = partial!(S.fun, 3); writeln(fun3("hello")); // 'l' writeln(fun3(10)); // 30 }
This worked: ```d import std.functional; 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 fun3 = partial!(S.fun, 3); writeln(fun3("hello")); // 'l' writeln(fun3(10)); // 30 } ```