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: [mg53915] Re: List Partition
  • From: Bill Rowe <readnewsciv at>
  • Date: Fri, 4 Feb 2005 04:11:10 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 2/2/05 at 6:25 AM, chocolatez at (zak) wrote:

>what could i do to partition the list:
>a={cat,E,in,the,hat,E,okay,fine,E} into

>ie:  every word in a sublist , and E determine the end of a
>sentence (a bigger list). zak

One way to do it would be as follows:

a = ToString /@ {cat, E, in, the, hat, E, okay, fine, E}
{"cat", "E", "in", "the", "hat", "E", "okay", "fine", "E"}

str = StringJoin @@ (StringJoin[#1, " "] & ) /@ a
"cat E in the hat E okay fine E "

ReadList[StringToStream[str], Word, RecordLists -> True, 
  RecordSeparators -> {"E"}]
{{"cat"}, {"in", "the", "hat"}, {"okay", "fine"}}
To reply via email subtract one hundred and four

  • Prev by Date: Re: List Partition
  • Next by Date: Re: List Partition
  • Previous by thread: Re: List Partition
  • Next by thread: Re: List Partition