Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to get non-printing heads?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46998] Re: How to get non-printing heads?
  • From: "Peter Pein" <no at spam.no>
  • Date: Fri, 19 Mar 2004 01:35:51 -0500 (EST)
  • References: <c388k0$bnb$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"kj" <socyl at 987jk.com> schrieb im Newsbeitrag
news:c388k0$bnb$1 at smc.vnet.net...
>
> How can I give a Mathematica object a different head?
>
> I tried
>
>   In[1]:= Head[a] ^= Constant;
>
> But, as shown below, this doesn't work as desired:
>
>   In[2]:= MatchQ[a, _Constant]
>
>   Out[2]= False
....

In[1]:= a = Constant["a"];
        a^2 + b^2
Out[2]= b^2 + Constant[a]^2
In[3]:= Unprotect[Constant];
        Format[Constant[x_String]] ^=  x;
        Protect[Constant];
        a^2 + b^2
Out[5]= b^2 + a^2
In[6]:= Head[a]
Out[6]= Constant

might do what you want
-- 
Peter Pein, Berlin
petsie at arcAND.de
replace && by || to write to me



  • Prev by Date: Re: List of solution
  • Next by Date: Notebook path in title bar of window and/or notebooks menu
  • Previous by thread: Re: How to get non-printing heads?
  • Next by thread: Left/right justifying rotated text