Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Reverse a Curry operation
ResourceFunction["Uncurry"][f,n] represents an operator form of the function f of n arguments so that ResourceFunction["Uncurry"][f,n][x1,…,xn] is equivalent to f[x1]…[xn]. | |
ResourceFunction["Uncurry"][f] represents an operator form of the function f of two arguments so that ResourceFunction["Uncurry"][f][x1,x2] is equivalent to f[x2][x1]. | |
ResourceFunction["Uncurry"][f,{i1,…,in}] represents an operator form of the function f of n arguments so that ResourceFunction["Uncurry"][f,{i1,…,in}][x1,…,xn] is equivalent to f[xj1]…[xjn], where jk is the position of k in the permutation list {i1,…,in}. | |
ResourceFunction["Uncurry"][f,k→{i1,…,in}] represents a k-arguments operator form of the function f of n arguments so that ResourceFunction["Uncurry"][f,k→{i1,…,in}][x1,…,xn] is equivalent to f[xj1]…[xjk], with k≥Max[{i1,…,in}], where jk is the position of k in the permutation list {i1,…,ik} with missing im filled in sequentially to form a complete permutation of length k. |
Uncurry a curried function:
In[1]:= |
Out[1]= |
In[2]:= |
Out[2]= |
In[3]:= |
Out[3]= |
In[4]:= |
Out[4]= |
In[5]:= |
Out[5]= |
A curried function that ignores its arguments cannot be completely uncurried:
In[6]:= |
Out[6]= |
The function loses an argument depending on its position in the uncurried permutation list:
In[7]:= |
Out[7]= |
In[8]:= |
Out[8]= |
In[9]:= |
Out[9]= |
This work is licensed under a Creative Commons Attribution 4.0 International License