MathGroup Archive 2005

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

Search the Archive

Re: opposite of partition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57604] Re: opposite of partition
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Wed, 1 Jun 2005 06:05:00 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 5/31/05 at 5:00 AM, guyi1 at netvision.net.il (Guy Israeli) wrote:

>How do I do the opposite of partition quickly?

>for example:

>l1= {{a, b, c, d, e}, {f, g, h, i, j}, {k, l, m, n, o}, {p, q, r,
>s, t}, {u, v, w, x, y}}

>and then if I partition it to blocks will result in

>{{{{a, b}, {f, g}}, {{c, d}, {h, i}}}, {{{k, l}, {p, q}}, {{m, n},
>{r, s}}}}

>flattening it won't help, and its messy to do it by taking all
>first lines of the blocks, then second..

>How can I do it quickly?

The question is what is it you want to do? 

Are you attempting to get the output you show after your "if I partition.." from l1?

If so, the following does the trick

Transpose[Partition[#, 2]&/@ Transpose[Partition[#1, 2]&/@ l1]]

{{{{a, b}, {f, g}}, {{c, d}, {h, i}}}, 
  {{{k, l}, {p, q}},{{m, n}, {r, s}}}}
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: reducing the time of constructing a List
  • Next by Date: Re: reducing the time of constructing a List
  • Previous by thread: Re: opposite of partition
  • Next by thread: Re: opposite of partition