ApplyTo[x,f] or x//=f

computes f[x] and resets x to the result.


  • ApplyTo[x,f] is effectively equivalent to x=x//f or x = f[x].
  • ApplyTo has attribute HoldFirst.
  • In ApplyTo[x,f], x can be a symbol or other expression with an existing value. »


open allclose all

Basic Examples  (1)

Create a variable with a value:

Use ApplyTo to compute f[x]:

The result is stored in x:

Scope  (5)

Use ApplyTo with an operator form:

Use ApplyTo with Function:

Use ApplyTo with Composition:

Use ApplyTo with RightComposition:

The first argument to ApplyTo need not be a symbol:

Applications  (2)

Use ApplyTo to swap two elements of a list:

The 3 and 5 have been swapped in list:

Properties & Relations  (3)

ApplyTo is a combination of Set and function application:

Equivalently, using postfix notation:

ApplyTo can be viewed as the assignment form of Construct:

ApplyTo is generalization of AddTo, AppendTo and similar functions:

Wolfram Research (2020), ApplyTo, Wolfram Language function,


Wolfram Research (2020), ApplyTo, Wolfram Language function,


@misc{reference.wolfram_2020_applyto, author="Wolfram Research", title="{ApplyTo}", year="2020", howpublished="\url{}", note=[Accessed: 16-January-2021 ]}


@online{reference.wolfram_2020_applyto, organization={Wolfram Research}, title={ApplyTo}, year={2020}, url={}, note=[Accessed: 16-January-2021 ]}


Wolfram Language. 2020. "ApplyTo." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2020). ApplyTo. Wolfram Language & System Documentation Center. Retrieved from