MathGroup Archive 2002

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

Search the Archive

Re: removing rules from function definitions

  • To: mathgroup at
  • Subject: [mg33042] Re: [mg33028] removing rules from function definitions
  • From: BobHanlon at
  • Date: Wed, 27 Feb 2002 00:47:58 -0500 (EST)
  • Sender: owner-wri-mathgroup at

In a message dated 2/26/02 6:52:13 AM, erich.neuwirth at writes:

>let me explain my problem with a simplified example
>i define
>f[1] := f[1] = 1
>f[n_] /; n > 1 := f[n] = f[n - 1]*2
>after evaluating f[1]
>i have
>  RuleDelayed[HoldPattern[f[3]],4],RuleDelayed[HoldPattern[f[4]],8],
>  RuleDelayed[HoldPattern[f[5]],16],RuleDelayed[HoldPattern[f[6]],32],
>  RuleDelayed[HoldPattern[f[7]],64],RuleDelayed[HoldPattern[f[8]],128],
>  RuleDelayed[HoldPattern[f[9]],256],
>  RuleDelayed[HoldPattern[f[10]],Times[f[Plus[10,-1]],2]],
>    Set[f[n],Times[f[Plus[n,-1]],2]]]]
>no i want to remove all the rules which were added during the
>essentially allows me to create a new rules list,
>but i cannot get MyPattern right
>does not work because HoldPattern gets evaluated,
>but doing it Verbatim does not work either
>because then _Integer is not evakuated and therefore does not work any
>i really ned a pattern matching all rules
>which interprets _Integer nonverbatim, but everything else verbatim.
>can anybody help me?

Drop does not work with patterns.  Use DeleteCases.


DownValues[f]= DeleteCases[DownValues[f], _?(#[[2]]>1&)];

Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Re: Sound and CDs query. Probably an FAQ but I could not find it.
  • Next by Date: RE: Hint on: Problems converting mathematica notebook to PDF with Acrobat Distiller
  • Previous by thread: removing rules from function definitions
  • Next by thread: Re: removing rules from function definitions