Apply is effectively necessary for Abstract Wikipedia, for the configurations of functions for a given language. Abusing built-in functions has got us to 1 and 2-args, but more will be needed to effectively write constructors. One could imagine this constructor (similar to the one from T383107):
"[sex] is a [country] [professional]"
This is currently not possible, we are limited to individual functions like:
"He is a [country] [professional]"
"She is a [country] [professional]"
We need to be able to do more. I suggest the ZID Z878, because it generates a Z7/Function call to a Z8/Function, but anything is fine.
Description
Details
| Subject | Author | Repo | Branch | Lines +/- | |
|---|---|---|---|---|---|
| wikifunctions: Upgrade orchestrator from 2026-10-14-161253 to 2026-10-28-013937 | Jforrester | operations/deployment-charts | master | +1 -1 |
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Resolved | cmassaro | T390226 Consider using list inputs to create variadic apply, filter, map, etc. functions | |||
| Resolved | cmassaro | T383842 Provide an n-argument apply |
Event Timeline
This can be done with a list, or an object -- no n-ary apply would be needed for that, I think
It can be done, but it's way too hard to use and unintuitive. n-apply is imo a basic higher-order function and both programming languages we support have a way to execute a function from a function object and list of arguments.
I'd be interested in knowing how it can be done. I've set up https://www.wikifunctions.org/view/en/Z22074 ready for implementations.
The reason I'm not sure it can be currently done is that the inbuilt functions we rely (map, reduce), can only run other functions with 1 and 2 parameters respectively. So once we get all the list elements into separate variables, I don't see how we can do the actual run of the function.
If I'm right, and we don't have another way to do it, then this would be very worthwhile. It is more general and would supersede my request at https://phabricator.wikimedia.org/T357858
@Sharvaniharan I'd like to stress again that this is very important for Wikifunctions and Wikidata access
Maybe what you mean is that every multi-argument function could be rewritten to take a single argument, essentially containing all others in a list or object? Once the function to be applied was rewritten, then the regular "apply" would work. If this is to be our medium-term workaround to this problem, IMO it would cause a proliferation of poorly-specified duplicate functions.
Seems like this is now possible without a built-in function (not sure if this is intended behavior, but it works!).
This is neither Declined nor Resolved; the user-land hack is unstable, unstable, and will likely break soon. Please do not close tasks like this without discussion first.
This can be implemented without hacks for arbitrarily large n (I assume there's a limit on code size for compositions, but I can't imagine a Function that would need dozens of distinct arguments).
Was it just this Implementation that was problematic, or is it all similar hacks using Z7/Function call?
apine updated https://gitlab.wikimedia.org/repos/abstract-wiki/wikifunctions/function-orchestrator/-/merge_requests/875
Supply built-in implementations for n-ary functional primitives.
dmartin merged https://gitlab.wikimedia.org/repos/abstract-wiki/wikifunctions/function-orchestrator/-/merge_requests/875
Supply built-in implementations for n-ary functional primitives.
Change #1359855 had a related patch set uploaded (by Jforrester; author: Jforrester):
[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-10-14-161253 to 2026-10-28-013937
Change #1359855 merged by jenkins-bot:
[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-10-14-161253 to 2026-10-28-013937
The back-end code for this is now live, but until T441053: Allocate ZIDs for N-Ary Map, Filter, Apply lands next week they're not yet callable from Wikifunctions.org in practice. Will leave in "needs sign-off" until then.