MathGroup Archive 1995

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

Search the Archive

Re: Deleting more subtle then Clear[ ] ?

  • Subject: [mg2273] Re: [mg2234] Deleting more subtle then Clear[ ] ?
  • From: hay at haystack.demon.co.uk (Allan Hayes)
  • Date: Thu, 19 Oct 1995 05:35:04 GMT
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: daemon at wri.com ( )

alfred at ca-risc.co.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
      Global`f
      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
      Global`f
      f[x_, y_] := f[x, y] = x - y


Allan Hayes
hay at haystack.demon.co.uk

*********
Begin forwarded message:

>From: alfred at ca-risc.co.at
>To: mathgroup at smc.vnet.net
>Subject: [mg2234] Deleting more subtle then Clear[ ] ?
>Organization: EUnet EDV DienstleistungsgesmbH, Wien


Well,
	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
--
================================                                         
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 ca-risc.co.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: CSG in Mathematica?
  • Next by Date: Re: Making Mathematica Functions Evaluate Rapidly?
  • Previous by thread: Re: Deleting more subtle then Clear[ ] ?
  • Next by thread: Re: Deleting more subtle then Clear[ ] ?