OperatorApplied

OperatorApplied[f,n]

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

OperatorApplied[f]

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

OperatorApplied[f,{i1,,in}]

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

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

represents an operator form that takes k arguments.

Details

  • OperatorApplied[f,arity][x1,][y1,][z1,] is equivalent to OperatorApplied[f,arity][x1,,y1,,z1,], so that the structure of brackets is not relevant, only the number of arguments.
  • OperatorApplied[f] is equivalent to OperatorApplied[f,{2,1}].
  • OperatorApplied[f,n] is equivalent to OperatorApplied[f,{1,2,,n}].
  • OperatorApplied[f,{i1,,in}] is equivalent to OperatorApplied[f,Max[{i1,,in}]->{i1,,in}].
  • OperatorApplied[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 OperatorApplied[f,{i1,,in}] will be the p^(th) argument of f.

Examples

open allclose all

Basic Examples  (3)

Use the operator form of a function, currying its second argument:

Curry a function of three arguments, keeping their order:

This is an operator form of Integrate that curries two integration variables:

Apply it to a function of variables and :

That is equivalent to:

Scope  (6)

Construct an operator form of D that curries its differentiation variable:

Apply the operator form:

Curry a function of 3 arguments, keeping their order:

Apply the operator form of a function of 3 reordered arguments using a permutation:

These are operator forms taking 4 arguments, but only 2 of them are passed to the function f:

Use arguments of the operator form with any bracketing structure:

Use an operator form of Level with default option values:

Pass options to Level:

Applications  (5)

Take an operator form of Composition for 3 functions:

Feed the 3 functions sequentially:

Apply the composition to an expression:

Specify how many arguments are functions to be composed:

Use OperatorApplied to construct the opposite order of a given ordering function:

Build an array of subscripted variables:

Build the K and S combinators using OperatorApplied:

The combinations SKK and SKS are equivalent to the identity:

Build the B and C combinators using S and K:

Properties & Relations  (8)

OperatorApplied[f,arity] represents the same operator as CurryApplied[f,arity]:

OperatorApplied[f] is equivalent to OperatorApplied[f,{2,1}]:

CurryApplied[n][f] is equivalent to CurryApplied[f,n]:

OperatorApplied[f][x,y] is equivalent to ReverseApplied[f][x,y]:

For a function of zero arguments, OperatorApplied[f,0] returns f[]:

If additional arguments are provided, the empty pair of brackets is still inserted:

Curry OperatorApplied itself:

Compare to Construct:

For positive n, OperatorApplied[Construct,n][f] is equivalent to OperatorApplied[f,n-1]:

The relation also holds for n=1:

Compose two OperatorApplied operators with a permutation and its inverse:

The result is equivalent to using OperatorApplied without reordering the arguments:

Take two permutation lists of the same length:

Compose the corresponding OperatorApplied operators:

Alternatively, use OperatorApplied with their permutation product, in the same order:

Introduced in 2020
 (12.1)