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: [mg20765] Re: [mg20744] Deleting a DownValue, Evaluate[f@@argList]=. does not do it
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Thu, 11 Nov 1999 00:22:42 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Here is one possible way :

In[1]:=
Clear[f];
Evaluate[f @@ {1}] = 1;
Evaluate[f @@ {2}] = 2;

In[4]:=
?f

Global`f

f[1] = 1
f[2] = 2

In[5]:=
Apply[Unset, ReplacePart[Hold[{1}], f, {1, 0}]]

In[6]:=
?f
Global`f
f[2] = 2



> From: hanssen at zeiss.de
> Date: Wed, 10 Nov 1999 00:17:53 -0500
> To: mathgroup at smc.vnet.net
> Subject: [mg20765] [mg20744] Deleting a DownValue, Evaluate[f@@argList]=. does not do it
> 
> Hi, MathGroup,
> 
> f[1]=1;
> f[2]=2;
> ?f
> 
> yields
> 
> "Global`f"
> f[1] = 1
> f[2] = 2
> 
> now get rid of definition for 1
> 
> f[1]=.;
> ?f
> 
> yields
> 
> "Global`f"
> f[2] = 2
> 
> 
> So far, it works as expected. I want to memorize results for combinations of
> arguments
> like f[a,b,c]=results and so on. To do this, I write f@@argList. Now I
> demonstrate
> this on lists with length 1, to make it simple. When making the assignment, it
> has to be 
> wrapped in Evaluate:
> 
> 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: TensorQ
  • Next by Date: Re: complex variable
  • 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