MathGroup Archive 1998

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

Search the Archive

Re: variation on Split


Barthelet, Luc wrote in message <6kpuc6$shf at smc.vnet.net>...
>
>Split[{a,b,c,d,d,e,f,g,g,h,h,h}] return
>{{a},{b},{c},{d,d},{e},{f},{g,g},{h,h,h}}
>
>What do you have to do to get:
>{{a,b,c},{d,d},{e,f},{g,g},{h,h,h}}
>?


Berthelet:

Split[{a,b,c,d,d,e,f,g,g,h,h,h}]

{{a},{b},{c},{d,d},{e},{f},{g,g},{h,h,h}}

Split[%, Length[#]==Length[#2]==1&]

{{{a},{b},{c}},{{d,d}},{{e},{f}},{{g,g}},{{h,h,h}}}

Flatten/@%

{{a,b,c},{d,d},{e,f},{g,g},{h,h,h}}


------------------------------------------------------------- 
Allan Hayes
Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay at haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642



  • Prev by Date: Re: 3D graphs/coord. axes
  • Next by Date: Re: 3D graphs/coord. axes
  • Previous by thread: Re: What am i missing?
  • Next by thread: RE: variation on Split