[Power Query] function curry with up to N levels and maintaining function signature types
This example demonstrates a Power Query function named `Function.CurryN` that enables currying of any function with up to N argument levels while preserving the original function's type signature. It shows how the function dynamically inspects the input function's parameter metadata via `Type.FunctionParameters` and `Type.FunctionRequiredParameters` to determine arity, then recursively builds and invokes intermediate closures using `Function.From` and `Function.Invoke`. The test file `test.pq` applies this to `Text.Contains`, first without a specified N (currying all three parameters), then with explicit N values of 2 and 1, illustrating flexible partial application. The implementation relies on Power Query's standard library functions like `Record.SelectFields` and `Type.ForFunction` to manage type safety across each curry level.
AI-generated description