MathGroup Archive 1997

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

Search the Archive

Re: Partition List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8431] Re: Partition List
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Sat, 30 Aug 1997 00:42:40 -0400
  • Organization: University of Western Australia
  • Sender: owner-wri-mathgroup at wolfram.com

Xah wrote:

> I want to partition a list, using special values in the list as boundary
> indicators. For example, myList={3,7,10,6,1,1,6,1,7,10,3,4,6} and my special
> value for boundary is 10, then my desired result would be
> result={{3,7},{10,6,1,1,6,1,7},{10,3,4,6}}.
> 
> How to do this using structure manipulating operators, 

  In[1]:= Split[{3, 7, 10, 6, 1, 1, 6, 1, 7, 10, 3, 4, 6}, #2 != 10 & ]
  Out[1]= {{3, 7}, {10, 6, 1, 1, 6, 1, 7}, {10, 3, 4, 6}}

Cheers,
	Paul 

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia           
Nedlands WA  6907                     mailto:paul at physics.uwa.edu.au 
AUSTRALIA                              http://www.pd.uwa.edu.au/Paul

            God IS a weakly left-handed dice player
____________________________________________________________________


  • Prev by Date: Re: Re: How to select unique elements in a list?
  • Next by Date: Re: Partition List
  • Previous by thread: Re: Partition List
  • Next by thread: Re: Partition List