MathGroup Archive 1994

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

Search the Archive

Behaviour of TagUnset

  • To: mathgroup at christensen.Cybernetics.NET
  • Subject: [mg278] Behaviour of TagUnset
  • From: Jason Harris <physjfh at phys.canterbury.ac.nz>
  • Date: Sun, 4 Dec 1994 23:35:58 +1300 (NZDT)

Hi Mathgroupers,

I have a question on the function TagUnset. I have been playing around 
and have found the following odd behaviour. Consider the following:

-----------------

In[1]:=
ClearAll[p];
Default[p] :=h;
p /: f[p[x]]:=x^2;

?p

Global`p

f[p[x]] ^:= x^2
 
Default[p] := h

-----------------

Now TagUnset works fine together with Literal on UpValues and DownValues 
as follows

-----------------

In[5]:=
TagUnset[p, Literal @ f @ p @ x]

In[6]:=
?p

Global`p

Default[p] := h

-----------------

But with Default Mathematica complains as follows

-----------------

In[7]:=
TagUnset[p, Literal @ Default @ p]

Unset::norep: Assignment on p for Default[p] not found.

Out[7]=
$Failed

In[8]:=
?p

Global`p

Default[p] := h

-----------------

One can get around this problem simply by omitting the Literal 

In[9]:=
TagUnset[p, Default @ p]

but I would have thought that the Literal in the above would have been fine.

Can anyone explain this?

Thanks,

Jason Harris
Physics Department
University of Canterbury
New Zealand






  • Prev by Date: Taking brackets off lists
  • Next by Date: Re: Question about function definitions
  • Previous by thread: Re: Taking brackets off lists
  • Next by thread: Re: Question about function definitions