Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Why does the order of down values come back?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124806] Re: Why does the order of down values come back?
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 7 Feb 2012 04:06:58 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201202060738.CAA10212@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

More specific patterns always come first.

In your example, especially, it would make NO sense to put them in the  
order you tried.

Bobby

On Mon, 06 Feb 2012 01:38:08 -0600, Shizu <slivo.vitz at msa.hinet.net> wrote:

> In[]:= f[0] := 0;f[1] := 1;f[n_] := f[n - 1] + f[n - 2]
>
> In[]:= DownValues[f]
> Out[]:= {HoldPattern[f[0]] :> 0, HoldPattern[f[1]] :> 1,  
> HoldPattern[f[n_]] :> f[n - 1] + f[n - 2]}
>
> In[]:= DownValues[f] = Reverse[DownValues[f]]
> Out[]:= {HoldPattern[f[n_]] :> f[n - 1] + f[n - 2], HoldPattern[f[1]] :>  
> 1, HoldPattern[f[0]] :> 0}
>
> In[]:= DownValues[f]
> Out[]:= {HoldPattern[f[0]] :> 0, HoldPattern[f[1]] :> 1,  
> HoldPattern[f[n_]] :> f[n - 1] + f[n - 2]}
>
> ====================================================
> My question is:
>
>     Why does the order of down values comes back after reordering?
>
> Thanks.
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: Why does the order of down values come back?
  • Next by Date: importing series of file with the same extension
  • Previous by thread: Why does the order of down values come back?
  • Next by thread: Re: Why does the order of down values come back?