User loginNavigation |
archivesIs there an existing name for my higher-order function?I have groups of functions that get called with the exact same arguments:
a = func_a(arg1, arg2, arg3, arg4, arg5);
b = func_b(arg1, arg2, arg3, arg4, arg5);
c = func_c(arg1, arg2, arg3, arg4, arg5);
To reduce duplication, I have a helper function that accepts any number of arguments and returns a second helper function. When called, this second function applies the arguments it was constructed with to other functions:
bar = foo(arg1, arg2, arg3, arg4, arg5);
a = bar(func_a);
b = bar(func_b);
c = bar(func_c);
My question is, what's the best name for "foo" in this second example? I've looked for higher-order functions in various languages but I'm having trouble finding examples of my specific usage--there are similar functions but nothing exactly the same. I'm hoping to find a canonical name for what I'm doing (if one exists). Like partial, foo() fixes the given arguments but it doesn't bind them to a specific function. The best name I can come up with is enclose() or callwith(). If anyone know of an already-existing name for this, I'd like to hear what it is. |
Browse archivesActive forum topics |
Recent comments
1 day 22 hours ago
2 days 19 hours ago
3 days 23 hours ago
3 days 23 hours ago
1 week 2 days ago
1 week 2 days ago
1 week 2 days ago
4 weeks 2 days ago
5 weeks 1 day ago
5 weeks 1 day ago