Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8379

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

From "Oleksandr Rasputinov" <oleksandr_rasputinov@ymail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Why does the order of down values come back?
Date 2012-02-07 09:08 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jgqpna$n12$1@smc.vnet.net> (permalink)
References <jgo0e9$a2k$1@smc.vnet.net>

Show all headers | View raw


On Mon, 06 Feb 2012 07:45:13 -0000, Shizu <slivo.vitz@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.
>

Because DownValues sorts its output by default. The actual downvalues are  
not, however, sorted; the order is as you set them. To see their actual  
order, use the (undocumented) option:

DownValues[f, Sort -> False]

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Why does the order of down values come back? Shizu <slivo.vitz@msa.hinet.net> - 2012-02-06 07:45 +0000
  Re: Why does the order of down values come back? David Reiss <dbreiss@gmail.com> - 2012-02-07 09:06 +0000
  Re: Why does the order of down values come back? David Reiss <dbreiss@gmail.com> - 2012-02-07 09:07 +0000
  Re: Why does the order of down values come back? "Oleksandr Rasputinov" <oleksandr_rasputinov@ymail.com> - 2012-02-07 09:08 +0000
    Re: Why does the order of down values come back? A Retey <awnl@gmx-topmail.de> - 2012-02-11 20:48 +0000
  Re: Why does the order of down values come back? DrMajorBob <btreat1@austin.rr.com> - 2012-02-08 10:29 +0000
  Re: Why does the order of down values come back? Leonid Shifrin <lshifr@gmail.com> - 2012-02-08 10:32 +0000
    Re: Why does the order of down values come back? "Oleksandr Rasputinov" <oleksandr_rasputinov@ymail.com> - 2012-02-09 10:39 +0000
    Re: Why does the order of down values come back? Christoph Lhotka <christoph.lhotka@fundp.ac.be> - 2012-02-10 11:00 +0000
  Re: Why does the order of down values come back? Leonid Shifrin <lshifr@gmail.com> - 2012-02-11 20:43 +0000

csiph-web