Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: List Partition

  • To: mathgroup at
  • Subject: [mg53932] Re: [mg53895] List Partition
  • From: "Wolf, Hartmut" <Hartmut.Wolf at>
  • Date: Fri, 4 Feb 2005 04:11:57 -0500 (EST)
  • Sender: owner-wri-mathgroup at


>-----Original Message-----
>From: zak [mailto:chocolatez at] 
To: mathgroup at
>Sent: Wednesday, February 02, 2005 12:26 PM
>To: mathgroup at
>Subject: [mg53932] [mg53895] List Partition
>what could i do to partition the list:
>ie:  every word in a sublist , and E determine the end of a 
>sentence (a bigger list).

In[14]:= r1 = Split[a, #1 =!= "E" &]
{{"cat", "E"}, {"in", "the", "hat", "E"}, {"okay", "fine", "E"}}

In[15]:= r2 = Drop[r1, {}, {-1}]
{{"cat"}, {"in", "the", "hat"}, {"okay", "fine"}}

In[16]:= Map[List, r2, {2}]
{{{"cat"}}, {{"in"}, {"the"}, {"hat"}}, {{"okay"}, {"fine"}}}

Hartmut Wolf

  • Prev by Date: Re: List Partition
  • Next by Date: Re: Problem with matching.
  • Previous by thread: Re: List Partition
  • Next by thread: Re: List Partition