MathGroup Archive 1999

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

Search the Archive

Re: Deleting a DownValue, Evaluate[f@@argList]=. does not do it

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20761] Re: Deleting a DownValue, Evaluate[f@@argList]=. does not do it
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 11 Nov 1999 00:22:40 -0500
  • Organization: Universitaet Leipzig
  • References: <80au96$j2i@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

Evaluate[ f @@ {1}]=.

can't work because when f @@ {1} is evaluated you get 1 and not f[1].
When you evaluate f @@ {1} to get f[1] the evaluation doe not stop after
this
step, it continues with the f[1]=1 definition.

The correct way is to create a HoldPattern[f[1]] and  modify the down
values by

toremove = $newsymbol @@ {1}; (* since $newsymbol has now downvalues one
get $newsymbol[1] *)
toremove = HoldPattern[Evaluate[toremove]] /. $newsymbol -> f; (* Now we
have HoldPattern[f[1]] *)
 
DownValues[f] = Select[DownValues[f], FreeQ[#, toremove] &]     

Hope that helps
  Jens


SNIP SNAP

> 
> Clear[f];
> Evaluate[f@@{1}]=1;
> Evaluate[f@@{2}]=2;
> ?f
> 
> yields
> 
> "Global`f"
> f[1] = 1
> f[2] = 2
> 
> as before. Now I want to get rid of the definition for 1 in the analogous way:
> 
> Evaluate[f@@{1}]=.
> 
> yields
> 
> Unset::usraw: Cannot unset raw object !
> $Failed
> 
> How to proceed without searching through DownValues[f] and deleting
> the one meant - very awkward?
> 
> kind regards
> 
> Dipl.-Math. Adalbert Hanszen


  • Prev by Date: Re: Running Mathematica under Linux Red Hat
  • Next by Date: Re: Color of GridLines
  • Previous by thread: Re: Deleting a DownValue, Evaluate[f@@argList]=. does not do it
  • Next by thread: Re: Deleting a DownValue, Evaluate[f@@argList]=. does not do it