Given an arbitrary expression, how can I have Mathematica only evaluate the (bound) symbols, i.e. replace them by their respective values, but not do any further simplification/evaluation of the expression? Trace shows me that indeed the evaluation of the symbols is done first, but how to stop the standard evaluation procedure at this point?
Example:
a = 7
expr = d + a + 3
What I would like to obtain is d+7+3
I tried
HoldForm[expr] /. x_Symbol -> Evaluate[x]
but this gives the plain HoldForm
of the expression. Symbol
, by the way, is apparently not the Head
of a bound symbol. In this case it is Integer
. Apart from that, the replacement rule with the selected evaluation does not work at all. But I can't find anything better.
Symbol
, but you must protect it from evaluation to see this. TryHead[Unevaluated[a]]
. $\endgroup$