MathGroup Archive 1999

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

Search the Archive

Re: Re: easiest way to sort a list?


Andrew,
I'm afraid your proposed solution works in the particular example you used,
but it doesn't in general. Cf. the following:

In[1]:=
in = {2, 1}
Out[1]=
{2, 1}
In[2]:=
elements = Union[in]
Out[2]=
{1, 2}
In[3]:=
positions = Flatten[First[Position[in, #]] & /@ elements]
Out[3]=
{2, 1}
In[4]:=
in[[positions]]
Out[4]=
{1, 2}

The correct solution is {2,1}.

Tomas Garza
Mexico City



  • Prev by Date: MultiplicativeOrder[k,n] ?
  • Next by Date: Career Opportunity with Wolfram Research
  • Previous by thread: Re: Re: easiest way to sort a list?
  • Next by thread: Re: Re: easiest way to sort a list?