For SetDelayed
, the kernel first makes the substitution literally, then does the further evaluation process if necessary.
I always think of SetDelayed
and related functions as global rule-replacing, in contrary to the local rule-replacing, namely, ReplaceAll
. However, such symmetry does not correspond so parallelly.
x + x + x + x /. x -> 3
The kernel first evaluates the left hand side expression to 4 x
, then applys the substitution. So my question occurs, is there a simple build-in mechanism that literally substitutes first, then does the possible further evaluation latter? If not, what is the easy and elegant way to do it by ourselves?