MathGroup Archive 2007

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

Search the Archive

Re: Selecting Sub-lists After Split

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77461] Re: Selecting Sub-lists After Split
  • From: chuck009 <dmilioto at comcast.com>
  • Date: Sat, 9 Jun 2007 05:35:35 -0400 (EDT)

My suggestion:

In[4]:=
list={1,2,-3,-7,4,-8,9,12,-3};
newlist={Select[list,#>0 &],Select[list,#<0 &]}

Out[5]=
{{1,2,4,9,12},{-3,-7,-8,-3}}

Now can access the positive sublist and negative sublist using newlist[[1,i]] for the positive and newlist[[2,i]] for the negatives.


  • Prev by Date: Re: Selecting Sub-lists After Split
  • Next by Date: Re: Selecting Sub-lists After Split
  • Previous by thread: Re: Selecting Sub-lists After Split
  • Next by thread: Re: Selecting Sub-lists After Split