MathGroup Archive 2007

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

Search the Archive

Re: Partition a list into sublists of unequal size

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83930] Re: Partition a list into sublists of unequal size
  • From: Tom Burton <news at brahea.com>
  • Date: Wed, 5 Dec 2007 07:02:45 -0500 (EST)

Proposed recipe:

1. Tighten your description a bit to "partition a list into sublists  
that start with an instance of a particular value".

2. Note that Partition is not well suited to this task. Browse "See  
Also" near the bottom of help on Partition.

3. Split looks good. Try it:

list={1,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0}

Split[list, #1 != 1 &]

4. Fiddle with the ends, depending upon your particular needs (not  
yet clear to me).

Tom

When responding, please replace news with my first initial and full  
last name, as one word.

Tom Burton





  • Prev by Date: expressions list -> equations list
  • Next by Date: Re: Insert a Math Symbol in Text in Notebook?
  • Previous by thread: Re: Partition a list into sublists of unequal size
  • Next by thread: Re: Partition a list into sublists of unequal size