TagSet

f/:lhs=rhs

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

Details

  • TagSet defines upvalues or downvalues as appropriate.
  • The symbol f in f/:lhs=rhs must appear in lhs as the head of lhs, the head of the head, one of the elements of lhs, or the head of one of the elements.
  • A common case is f/:h[f[args]]=rhs.
  • You can see all the rules associated with a particular symbol by typing ?symbol.
  • If f appears several times in lhs, then f/:lhs=rhs associates the assignment with each occurrence.
  • When it appears in unevaluated symbolic form, TagSet is treated as a scoping construct so that variables in nested occurrences are renamed if necessary.

Examples

open allclose all

Basic Examples  (1)

Define a symbolic property of a symbol:

In[1]:=
Click for copyable input
Out[1]=

Scope  (3)

Applications  (1)

Properties & Relations  (5)

Possible Issues  (2)

See Also

TagSetDelayed  TagUnset  Set  UpSet

Tutorials

Introduced in 1988
(1.0)