WLJS LogoWLJS Notebook

TagSet

f /: lhs = rhs assigns rhs to be the value of lhs, and associates the assignment with the symbol f.

TagSet is used to create upvalues, associating definitions with auxiliary symbols.

Examples

f /: g[f[x_]] := x^2
g[f[3]]
myType /: Plus[myType[a_], myType[b_]] := myType[a + b]
vec /: Dot[vec[a_], vec[b_]] := a.b

*See the official Wolfram Language Reference for more details.

On this page