Re: DownValues question
- To: mathgroup at smc.vnet.net
- Subject: [mg70093] Re: DownValues question
- From: dimmechan at yahoo.com
- Date: Tue, 3 Oct 2006 06:16:39 -0400 (EDT)
- References: <efld9n$d49$1@smc.vnet.net><efq5mt$2bi$1@smc.vnet.net>
Yes, I was wrong. Thanks for your advice. Regards Dimitris Jens-Peer Kuska wrote: > 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. > >