Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: Deleting more subtle then Clear[ ] ?

  • To: mathgroup at
  • Subject: [mg2273] Re: [mg2234] Deleting more subtle then Clear[ ] ?
  • From: Allan Hayes <hay at>
  • Date: Thu, 19 Oct 1995 01:35:04 -0400

alfred at
in [mg2234] Deleting more subtle then Clear[ ] ?
asks about selective clearing (see attached messege).
I hope the following example may help.

   f[x_,y_] := f[x,y] = x -y
   Do[f[x,y], {x,1,2},{y,1,2}]

      f[1, 1] = 0
      f[1, 2] = -1
      f[2, 1] = 1
      f[2, 2] = 0
      f[x_, y_] := f[x, y] = x - y

   dv = DownValues[f]
      {Literal[f[1, 1]] :> 0, Literal[f[1, 2]] :> -1,
       Literal[f[2, 1]] :> 1, Literal[f[2, 2]] :> 0,
       Literal[f[x_, y_]] :> (f[x, y] = x - y)

Now change DownValues by standard techniques.
For example

   DownValues[f] =
      Cases[dv,e_/;FreeQ[e, Literal[f[_?NumberQ,_?NumberQ]]]]

      {Literal[f[x_, y_]] :> (f[x, y] = x - y)}

      f[x_, y_] := f[x, y] = x - y

Allan Hayes
hay at

Begin forwarded message:

>From: alfred at
>To: mathgroup at
>Subject: [mg2234] Deleting more subtle then Clear[ ] ?
>Organization: EUnet EDV DienstleistungsgesmbH, Wien

	Let's assume we have a function f[x,y,z] where x and y are  
VERY big or
time consuming lists of numbers or functions.
	By defining f[x_,y_,z_]:= f[x,y,z] =   I make MMA remember  
what it did.
How can I now tell it to disremember for all f[x,*,*] when I  
specifically want
it to reprocess whatever is dependend on x (i.e. the contents of  
the file has
changed but the name is the same) but NOT on y?

Thanks for help

Alfred H. Corrodi		"Capitalism is based on the assumption 
Risk Manager			 that you can win the game. Communism  	
Creditanstalt-Bankverein	 is based on the assumption that you can
alfred at (NeXT)	 break even. Mysticism is based on the
Tel/43/1/531311967 Fax/5337341   assumption that you can leave the game."

  • Prev by Date: Re: color in ListContourPlot
  • Next by Date: TeX labels in graphs
  • Previous by thread: Re: Deleting more subtle then Clear[ ] ?
  • Next by thread: large expressions