This question already has an answer here:

I've seen this idiom used in different programs but never fully understand why it is necessary. Could someone explain? Is it still the recommended way to replace some part of a held expression to its evaluated value? Is there an alternative method that uses more built-in functionality?

heldExpression /: lhs_ :> evaluate[rhs_] := lhs :> With[{tmp = rhs}, tmp /; True]

marked as duplicate by WReach, m_goldberg, J. M. is away Nov 6 '17 at 0:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.