Curry

Curry[f,n]

represents an operator form of the function f of n arguments so that Curry[f,n][x1][xn] is equivalent to f[x1,,xn].

Curry[f]

represents an operator form of the function f of two arguments so that Curry[f][y][x] is equivalent to f[x,y].

Curry[f,{i1,,in}]

represents an operator form of the function f of n arguments so that Curry[f,{i1,,in}][x1][xn] is equivalent to f[xi1,,xin].

Curry[f,k{i1,,in}]

represents a k-arguments operator form of the function f of n arguments so that Curry[f,k{i1,,in}][x1][xk] is equivalent to f[xi1,,xin], with kMax[{i1,,in}].

Details

  • Curry[f] is equivalent to Curry[f,{2,1}].
  • Curry[f,n] is equivalent to Curry[f,{1,2,,n}].
  • Curry[f,{i1,,in}] is equivalent to Curry[f,Max[{i1,,in}]->{i1,,in}].
  • Curry[f,{i1,,in,opts}][x1][xk] is equivalent to f[xi1,,xin,opts] for a sequence opts of options.
  • The ip^(th) curried argument of Curry[f,{i1,,in}] will be the p^(th) argument of f.
  • Curry[f,arity][x1,][y1,][z1,] is equivalent to Curry[f,arity][x1,,y1,,z1,], so that the structure of brackets is not relevant, only the number of arguments.

Examples

open allclose all

Basic Examples  (3)

Curry the second argument of a function of two arguments:

In[1]:=
Click for copyable input
Out[1]=

Curry a function of three arguments, keeping their order:

In[1]:=
Click for copyable input
Out[1]=

This is a curried form of Integrate that curries two integration variables:

In[1]:=
Click for copyable input
Out[1]=

Apply it to a function of variables and :

In[2]:=
Click for copyable input
Out[2]=

That is equivalent to:

In[3]:=
Click for copyable input
Out[3]=

Scope  (6)

Applications  (5)

Properties & Relations  (6)

See Also

Construct  Composition  Function  Slot  Identity  Apply  Map

Introduced in 2018
(11.3)