MathGroup Archive 2006

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

Search the Archive

Re: position lists


In[22]:=
a = {1, 1, 2, 2, 1, 4} ;
In[23]:=
Flatten[Reap[MapIndexed[Sow[#2[[1]],#1]&,a],Range[4]][[2]]/.{}:>{{0}},1]
Out[23]=
{{1,2,5},{3,4},{0},{6}}
In[24]:=
b=Reverse[a]
Out[24]=
{4,1,2,2,1,1}
In[25]:=
Flatten[Reap[MapIndexed[Sow[#2[[1]],#1]&,b],Range[4]][[2]]/.{}:>{{0}},1]
Out[25]=
{{2,5,6},{3,4},{0},{1}}

dkr


  • Prev by Date: question?
  • Next by Date: Several functions in a single 2D-plot
  • Previous by thread: Re: position lists
  • Next by thread: Re: position lists