MathGroup Archive 2006

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

Search the Archive

Deleting Selective DownValues

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63984] Deleting Selective DownValues
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 26 Jan 2006 03:43:10 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear MathGroup,

Suppose I have established the following definitions for f, but not necessarily in the given order.

Clear[f]
f[x_, y_, z_] := x y z
f[a_, b_] := a b
f[x_] := x
DownValues[f]
{HoldPattern[f[x_, y_, z_]] :> x y z, HoldPattern[f[a_, b_]] :> a b, 
  HoldPattern[f[x_]] :> x}

Now I would like to delete the f definition that has a given number of arguments, say f[a_,b_] with 2 arguments. So I need a routine:

deleteDownValue[label_Symbol,numberOfArgs_Integer?Positive]:= ???

which would reset DownValues[label] to eliminate any definition with numberOfArgs arguments.

I have trouble with doing the matches and evaluation sequences. Can anyone help with this? Many thanks in advance.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 


  • Prev by Date: Deleting Selective DownValues
  • Next by Date: Re: Factorising polynomials
  • Previous by thread: Re: Deleting Selective DownValues
  • Next by thread: Re: Deleting Selective DownValues