This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Programming / Rule Application  /
RuleDelayed

  • lhs :> rhs or lhsrhs represents a rule that transforms lhs to rhs, evaluating rhs only after the rule is used.
  • The character can be entered as :> or \[RuleDelayed].
  • RuleDelayed has the attribute HoldRest.
  • You can apply rules using Replace.
  • The assignment lhs := rhs specifies that the rule lhs :> rhs should be used whenever it applies.
  • You can use Condition to specify when a particular rule applies.
  • lhsrhs can be entered as lhs \[RuleDelayed] rhs or lhs :> rhs.
  • In StandardForm, RuleDelayed is printed using .
  • See notes for Rule.
  • See the Mathematica book: Section 2.4.1Section A.5.5.
  • See also: Replace, SetDelayed, Rule.

    Further Examples

    The right-hand side of this rule is evaluated when you give the rule.

    In[1]:=

    Out[1]=

    A rule like this is probably not particularly useful.

    In[2]:=

    Out[2]=

    Here, the right-hand side of the rule is maintained in an unevaluated form, to be evaluated every time the rule is used.

    In[3]:=

    Out[3]=

    Applying the rule causes the expansion to be done.

    In[4]:=

    Out[4]=