MathGroup Archive 2002

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

Search the Archive

Re: memoizing function again


In article <a2ong2$5uo$1 at smc.vnet.net>, kuska at informatik.uni-leipzig.de 
wrote:

> ClearConstantArg[f_Symbol] := 
>   DownValues[f] = 
>     DownValues[f] /. (Verbatim[HoldPattern][f[_Integer]] :> _) :>
> Sequence[]
> 
> will do it. For what do wish to use Cases[] ?

Because Cases (or DeleteCases) is (slightly) more elegant?

   ClearConstantArg[f_Symbol] := 
      DownValues[f] = DeleteCases[DownValues[f], 
         Verbatim[HoldPattern][f[_Integer]] :> _]

Cheers,
   Paul

-- 
____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________


  • Prev by Date: Re: Re: Simulating Correlated non-Normal Random Variables
  • Next by Date: Re: Keeping order with Union
  • Previous by thread: RE: RE: memoizing function again
  • Next by thread: Mathematica for Linux font problem on SuSE7.3