ApplyTo[x,f] or x//=f
computes f[x] and resets x to the result.
ApplyTo 
ApplyTo[x,f] or x//=f
computes f[x] and resets x to the result.
Examples
open all close allBasic Examples (1)
Create a variable with a value:
x = 1Use ApplyTo to compute f[x]:
x//=fxScope (5)
Use ApplyTo with an operator form:
x = {1, 2, 3};
x//=Map[f];
xx = {1, 2, 3};
x//=# ^ 2&;
xUse ApplyTo with Composition:
x = 1;
x//=f @* g;
xUse ApplyTo with RightComposition:
x = 1;
x//=f /* g;
xThe first argument to ApplyTo need not be a symbol:
list = {1, 2, 3}list[[2]]//=flistApplications (2)
Use ApplyTo to swap two elements of a list:
list = Range[6];list[[{3, 5}]]//=ReverseThe 3 and 5 have been swapped in list:
list(mat = Table[((i + j)π/4), {i, 4}, {j, 4}])//MatrixFormUse ApplyTo to evaluate the Sin of the second column:
mat[[All, 2]]//=SinThe column was modified in place:
mat//MatrixFormProperties & Relations (3)
ApplyTo is a combination of Set and function application:
x = a;
x//=f;
xx = a;
x = f[x];
xEquivalently, using postfix notation:
x = a;
x = x//f;
xApplyTo can be viewed as the assignment form of Construct:
x = a;
x = Construct[f, x];
xApplyTo is a generalization of AddTo, AppendTo and similar functions:
y = 1; z = 1;
y//=# + 2&;
z += 2;
y === zy = {a, b, c}; z = {a, b, c};
y//=Append[#, d]&;
AppendTo[z, d];
y === zSee Also
Set Construct AddTo AppendTo Function Composition RightComposition
Related Guides
History
Text
Wolfram Research (2020), ApplyTo, Wolfram Language function, https://reference.wolfram.com/language/ref/ApplyTo.html.
CMS
Wolfram Language. 2020. "ApplyTo." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ApplyTo.html.
APA
Wolfram Language. (2020). ApplyTo. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ApplyTo.html
BibTeX
@misc{reference.wolfram_2026_applyto, author="Wolfram Research", title="{ApplyTo}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ApplyTo.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_applyto, organization={Wolfram Research}, title={ApplyTo}, year={2020}, url={https://reference.wolfram.com/language/ref/ApplyTo.html}, note=[Accessed: 13-June-2026]}