Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: position lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68739] Re: position lists
  • From: "dkr" <dkrjeg at adelphia.net>
  • Date: Thu, 17 Aug 2006 04:18:50 -0400 (EDT)
  • References: <ebujvu$6lu$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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