MathGroup Archive 2004

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

Search the Archive

Re: How to get non-printing heads?

"kj" <socyl at> schrieb im Newsbeitrag
news:c388k0$bnb$1 at
> 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;
        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
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