Re: Why does the order of down values come back?
- To: mathgroup at smc.vnet.net
- Subject: [mg124788] Re: Why does the order of down values come back?
- From: Shizu <slivo.vitz at msa.hinet.net>
- Date: Tue, 7 Feb 2012 04:00:36 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
In[]:= g[x_ + y_] := op1[x, y]; g[x_ y_] := op2[x, y]
In[]:= DownValues[g]
Out[]:= {HoldPattern[g[x_ + y_]] :> op1[x, y], HoldPattern[g[x_ y_]] :> op2[x, y]}
In[]:= DownValues[g] = Reverse[DownValues[g]]
Out[]:= {HoldPattern[g[x_ y_]] :> op2[x, y], HoldPattern[g[x_ + y_]] :> op1[x, y]}
In[]:= DownValues[g]
Out[]:= {HoldPattern[g[x_ y_]] :> op2[x, y], HoldPattern[g[x_ + y_]] :> op1[x, y]}
===================================================
What I did here does NOT make sense either.
But after reordering, the original order doesn't come back.
This one is predictable.
Actually, we can even define the previous function as follows:
In[]:= f[n_] := f[n - 1] + f[n - 2];
f[1] := 1;
f[0] := 0;
In[]:= f[10]
Out[]:= 55
The order we set up the function is not important.
Any comments?
Thanks.