MathGroup Archive 2005

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

Search the Archive

Re: List Partition


a = {"cat", "E", "in", "the", "hat", "E", "okay", "fine", "E"};
Split[a, !Xor @@ Thread[{##1} == "E"] & ] /. {"E"} :> Sequence[]

{{"cat"}, {"in", "the", "hat"}, {"okay", "fine"}}

% /. a_String :> {a}

{{{"cat"}}, {{"in"}, {"the"}, {"hat"}}, {{"okay"}, {"fine"}}}

Bobby

On Wed, 2 Feb 2005 06:25:59 -0500 (EST), zak <chocolatez at gmail.com> wrote:

> what could i do to partition the list:
> a={cat,E,in,the,hat,E,okay,fine,E}
> into
> a={{cat},{{in},{the},{hat}},{{okay},{fine}}}
>
> ie:  every word in a sublist , and E determine the end of a sentence
> (a bigger list).
> zak
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: crash on x86_64: mathematica
  • Next by Date: Re: List Partition
  • Previous by thread: Re: List Partition
  • Next by thread: Re: Re: List Partition