RuleDelayed
lhs :> rhs
can be used in replacement functions to say that instances of lhs
should be replaced with rhs
, evaluating rhs
only after replacement.
Attributes[RuleDelayed] := {HoldRest, Protected, SequenceHold}
Simple examples
To demonstrate the difference betweenRule
and RuleDelayed
: