Re: arrange lists side by side

• To: mathgroup at smc.vnet.net
• Subject: [mg56577] Re: [mg56538] arrange lists side by side
• From: yehuda ben-shimol <bsyehuda at gmail.com>
• Date: Fri, 29 Apr 2005 03:20:55 -0400 (EDT)
• References: <200504280640.CAA24672@smc.vnet.net>
• Reply-to: yehuda ben-shimol <bsyehuda at gmail.com>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi mark
you can try t use this code
Thread[List[Take[Nest[Join[a, #] &, a, Floor[Length[b]/Length[a]]], Length[
b]], b]]
Then for
a = {28, 30, 17};
b = {1, 2, 9, 4, 5, 7, 3, 8};
you will get
{{28, 1}, {30, 2}, {17, 9}, {28, 4}, {30, 5}, {17, 7}, {28, 3}, {30, 8}}
yehuda

On 4/28/05, marloo3 at mail15.com <marloo3 at mail15.com> wrote:
> Hi
> is there a way to spread out a small list over a bigger list recurrently like
> this:
> a={28, 30, 17};
> b={1, 2, 9, 4, 5, 7, 3, 8};
> to give the output:
> {{1,28},{2,30},{9,17},{4,28},{5,30},{7,17},{3,28},{8,30}};
> the number of items in "b" do not neccesary  multiples of the number of items
> in "a"
> mark
>
> okay this is my approach
>
> a={28,30,17};
> b={1,2,9,4,5,7,3,8};
> aa={};aa=Table[Join[aa,a],{i,Length[b]/Length[a]}]
>
> Out[]=
> {{28,30,17},{28,30,17}}
>
> frc=Mod[Length[b],Length[a]];
> gg=Flatten[Join[aa,Part[a,{1,frc}]]];
> Transpose[Join[{b},{gg}]]
>
> Out[]=
> {{1,28},{2,30},{9,17},{4,28},{5,30},{7,17},{3,28},{8,30}}
>
> ----------------------------------------------------------------------
>
>

```

• Prev by Date: Re: MLGetByteString
• Next by Date: Re: can Mathematica be useful for this?
• Previous by thread: Re: arrange lists side by side
• Next by thread: Re: arrange lists side by side