I am a little bit puzzled by the following, for me inconsistent, behaviour of Inactivate
.
expr=HoldForm[f[a,b]];
Inactivate[expr] // InputForm
(* HoldForm[f[a, b]] *)
Nothing has happened. The documentation states, a little bit vague: Hold
maintains expressions in unevaluated form, and all parts are inactive. With respect to the second statement, observe that the parts inside Hold
are not wrapped in Inactive
.
expr={HoldForm[f[a,b]]};
Inactivate[expr] // InputForm
(* {HoldForm[f[a, b]]} *)
This is as above. However:
Inactivate /@ expr // InputForm
(* {HoldForm[Inactive[f][a, b]]} *)
Mathematica has to evaluate {Inactivate[HoldForm[f[a,b]]]}
, for which, according to the first example, I would have expected {HoldForm[f[a,b]]}
. However, in this situation the heads have been inactivated.
Is there any documentation on this phemomenon? More precisely: under what conditions are the heads in an held expression explicitely inactivated and when not?
Inactivate[Hold[f[a, b]]]
works as expected, but the indirect approach you demonstrate does not. $\endgroup$