MathGroup Archive 2005

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

Search the Archive

Re: List Partition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53912] Re: [mg53895] List Partition
  • From: DrBob <drbob at bigfoot.com>
  • Date: Fri, 4 Feb 2005 04:11:06 -0500 (EST)
  • References: <200502021125.GAA29007@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

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