[Date Index] [Thread Index] [Author Index]
Re: Clearing function definitions by argument type?
f[x_]:=f[x]=x^2; f/@Range[0,2]; ?f Off[RuleDelayed::rhs]; Unset/@(#[]&/@Drop[DownValues[f],-1]); On[RuleDelayed::rhs]; ?f Bob Hanlon > > From: Gareth Russell <gjr2008 at columbia.edu> To: mathgroup at smc.vnet.net > Date: 2005/05/21 Sat AM 02:41:16 EDT > Subject: [mg57252] [mg57243] Clearing function definitions by argument type? > > 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=1 > f=1 > f=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 > >