Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8651

Re: Why HoldForm[] shows this expression in red in notebook?

From Szabolcs Horvát <szhorvat@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Why HoldForm[] shows this expression in red in notebook?
Date 2012-02-20 07:57 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jhsud9$nqj$1@smc.vnet.net> (permalink)
References <jhqml4$f9t$1@smc.vnet.net>

Show all headers | View raw


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/

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Why HoldForm[] shows this expression in red in notebook? "Nasser M. Abbasi" <nma%12000.org@gtempaccount.com> - 2012-02-19 11:32 +0000
  Re: Why HoldForm[] shows this expression in red in notebook? David Bailey <dave@removedbailey.co.uk> - 2012-02-20 07:51 +0000
    Re: Why HoldForm[] shows this expression in red in notebook? "Nasser M. Abbasi" <nma@12000.org> - 2012-02-21 11:09 +0000
      Re: Why HoldForm[] shows this expression in red in notebook? David Bailey <dave@removedbailey.co.uk> - 2012-02-23 10:46 +0000
  Re: Why HoldForm[] shows this expression in red in notebook? Szabolcs Horvát <szhorvat@gmail.com> - 2012-02-20 07:57 +0000

csiph-web