WLJS LogoWLJS Notebook

ApplyTo

ApplyTo[x, f] or x //= f computes f[x] and resets x to the result.

Examples

Apply a function to a variable in place:

x = 5;
x //= Sqrt;
x
(* Sqrt[5] *)

Chain operations:

list = {3, 1, 4, 1, 5};
list //= Sort;
list
(* {1, 1, 3, 4, 5} *)

Please visit the official Wolfram Language Reference for more details.

On this page