Re: Re: Clearing function definitions by argument type?
- To: mathgroup at smc.vnet.net
- Subject: [mg57272] Re: [mg57247] Re: Clearing function definitions by argument type?
- From: DrBob <drbob at bigfoot.com>
- Date: Mon, 23 May 2005 02:20:40 -0400 (EDT)
- References: <firstname.lastname@example.org> <200505220414.AAA17582@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
On Sun, 22 May 2005 00:14:11 -0400 (EDT), David Bailey <dave at Remove_Thisdbailey.co.uk> wrote:
> Gareth Russell wrote:
>> Hi Group,
>> Is there a straightforward way to Clear only definitions that take
>> certain kinds of arguments? For example, I might have
>> 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
>> type of function, without clearing the function itself.
>> Gareth Russell
>> Columbia University
> You can see all the assignments in DownValues[g], and you could remove
> the parts of that list that you did not want and then execute
> However, I think it might be easier to rearrange your problem a bit. If
> you 'remember' your answers in another function - g, then you can write
> f as
> f[x_] := If[NumberQ[g[x]], g[x], g[x] = x^2]
> Then you can just use Clear[g] when you want to start the next problem.
> David Bailey
DrBob at bigfoot.com
Prev by Date:
Re: MultipleListPlot and Log-List plots
Next by Date:
Re: Re: Bode Plots in Mathematica
Previous by thread:
Re: Clearing function definitions by argument type?
Next by thread:
Bode Plots in Mathematica