Unevaluated is a function that I never truly understand, and here's one of the cases confusing me:
Unevaluated[1 + 1] -> 3
(* 2 -> 3 *)
Same thing happens on right side of Rule and left side of RuleDelayed (:>) i.e. Unevaluated affects none of the unheld sides of Rule/RuleDelayed:
2 -> Unevaluated[1 + 2]
(* 2 -> 3 *)
Unevaluated[1 + 1] :> 3
(* 2 :> 3 *)
Trace shows that Unevaluated does seem to work for once, but after that,Rule evaluates its left side again:
Unevaluated[1 + 1] -> 3 // Trace
No matter how many Unevaluated exists, Rule will tenaciously evaluate again and again, until the Unevaluateds are all killed:
Unevaluated@Unevaluated@Unevaluated@Unevaluated[1 + 1] -> 3 // Trace
My questions are:
Is this just a individual case i.e. a special behavior of
Rule/RuleDelayed, or there's a class of function that shares the same behavior?Why
Rule/RuleDelayedis designed to behave like this? Is there any deep meaning?


Unevaluatedis only kept untilRulerecieves its arguments (as the documentation states), but afterwards arguments are evaluated normally asRuledoes not have attributeHoldAllor similar. Compare withf[x_] := x;f[Unevaluated[1 + 1]]which also returns 2. – István Zachar Mar 19 '16 at 15:37f[Unevaluated@Unevaluated[1 + 1]]will returnUnevaluated[1 + 1]. – xzczd Mar 19 '16 at 15:41Replacefamily. Furthermore,Associationbehaves similar (whileDirectedEdgedoes not) – István Zachar Mar 19 '16 at 15:45