Re: variation on Split
- To: mathgroup at smc.vnet.net
- Subject: [mg12673] Re: variation on Split
- From: "Allan Hayes" <hay at haystack.demon.cc.uk>
- Date: Mon, 1 Jun 1998 23:16:46 -0400
- References: <6kpuc6$shf@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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