Rules

Everything that the Wolfram Language does can be thought of as derived from its ability to apply general transformation rules to arbitrary symbolic expressions. The Wolfram Language provides flexible functions that give direct access to the Wolfram Language's powerful rule transformation engine.

ReferenceReference

Representing Rules

Rule (->) immediate replacement rule for any pattern

RuleDelayed (:>) delayed rule, with right-hand side evaluated only when used

Applying Rules

ReplaceAll (/.) apply replacement rules throughout an expression

ReplaceRepeated (//.) apply replacement rules repeatedly until no change occurs

Replace apply replacement rules to a complete expression

ReplaceList a list of all possible ways to apply rules

SparseArray give rules for values at particular positions in an array