Re: Why HoldForm[] shows this expression in red in notebook?
- To: mathgroup at smc.vnet.net
- Subject: [mg125076] Re: Why HoldForm[] shows this expression in red in notebook?
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Mon, 20 Feb 2012 02:52:39 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jhqml4$f9t$1@smc.vnet.net>
On 2/19/2012 1:32 PM, Nasser M. Abbasi wrote:
> foo[x_, v_] := Module[{z = v},
> {x^z, Hold[x^z], HoldForm[x^z]}
> ];
Hi Nasser,
I assume it is a warning that z (the Module variable) will not be evaluated.
One might expect foo[x,2] to give {..., HoldForm[x^2]}. It will not
because z never evaluates to 2 (the expression that was substituted for v)
Why this warning is not shown for Hold? I don't know. I guess the
results from HoldForm might be more confusing because if how it is
printed. I fell into this trap with HoldForm before (when trying to use
it in plot labels) but not with Hold (where I typically focus on the
hold-properties rather than formatting).
So again, this is just a guess.
--
Szabolcs Horvát
Visit Mathematica.SE: http://mathematica.stackexchange.com/