Re: Clearing function definitions by argument type?

*To*: mathgroup at smc.vnet.net*Subject*: [mg57253] Re: [mg57243] Clearing function definitions by argument type?*From*: "David Park" <djmp at earthlink.net>*Date*: Sun, 22 May 2005 00:14:18 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Gareth, f[x_] := x^2 f[0] = 1 f[1] = 1 f[2] = 7 DownValues[f] {HoldPattern[f[0]] :> 1, HoldPattern[f[1]] :> 1, HoldPattern[f[2]] :> 7, HoldPattern[f[x_]] :> x^2} DownValues[f] = Last[DownValues[f]] HoldPattern[f[x_]] :> x^2 David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Gareth Russell [mailto:gjr2008 at columbia.edu] To: mathgroup at smc.vnet.net Hi Group, Is there a straightforward way to Clear only definitions that take certain kinds of arguments? For example, I might have f[x_]:=x^2 f[0]=1 f[1]=1 f[2]=7 ... and want to clear all f[number] definitions but not the DelayedSet definition. (Note that the number of f[number] definitions will vary, as will the numbers that each one takes as an argument.) My goal is to clear 'memorized' definitions after an optimization run, where the memorized definitions are generated by a f[x_]:=f[x]=x^2 type of function, without clearing the function itself. Gareth Russell Columbia University