MathGroup Archive 2006

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

Search the Archive

Re: DownValues question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70075] Re: DownValues question
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Mon, 2 Oct 2006 00:33:49 -0400 (EDT)
  • References: <efld9n$d49$1@smc.vnet.net>

Hi,

you are sure that
DownValues[f] = Reverse[DownValues[f]]

"(re)assign a new value to DownValues"
and not to DownValues[f] ??

Regards
   Jens


dimmechan at yahoo.com wrote:
> One more question. (I apologise for the number of questions).
> 
> The following rule is not allowed
> 
> x + y = z
> Set::write : Tag Plus in x + y is Protected.
> z
> 
> since Plus has the attribute Protected.
> 
> If you want to avoid the drastic way of Unprotect Plus and add the rule
> 
> you can use
> 
> x /: x + y = z
> z
> 
> Suppose now the following
> 
> Clear[f]
> f[x_, 2] := foo
> f[2, x_] := foofoo
> 
> Then
> 
> DownValues[f]
> {HoldPattern[f[x_, 2]] :> foo, HoldPattern[f[2, x_]] :> foofoo}
> 
> If you want, you can change the order that assigned down values are
> stored by
> 
> DownValues[f] = Reverse[DownValues[f]]
> {HoldPattern[f[2, x_]] :> foofoo, HoldPattern[f[x_, 2]] :> foo}
> 
> However
> 
> Attributes[DownValues]
> {HoldAll, Protected}
> 
> Using Set we attach a value to the head of the left-hand side.
> So, how we can (re)assign a new value to DownValues if its Head
> has the attribute Protected?
> 
> Thanks in advance for any help.
> 


  • Prev by Date: Re: equation question
  • Next by Date: Re: tableform question
  • Previous by thread: Re: equation question
  • Next by thread: Re: DownValues question