WLJS LogoWLJS Notebook

UpSet

lhs ^= rhs assigns rhs to be the value of lhs, and associates the assignment with symbols that occur at level one in lhs.

Examples

Associate with a symbol in an expression:

Format[myObj[x_]] ^= Row[{"Object: ", x}];
myObj[5]
(* Object: 5 *)

Define behavior for a head:

f[g[x_]] ^= x^2;
f[g[3]]
(* 9 *)

Please visit the official Wolfram Language Reference for more details.

On this page