Re: Joining lists
- To: mathgroup at smc.vnet.net
- Subject: [mg37874] Re: Joining lists
- From: Rainer Gruber <rainer.gruber at gmx.at>
- Date: Sat, 16 Nov 2002 01:15:39 -0500 (EST)
- Organization: Johannes Kepler Universitaet Linz
- References: <ar0033$b1p$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Pigeon, Robert wrote:
> [...]
> a={1,2,3};
> b={4,5,6};
> c={{a[[1]],b[[1]]},{a[[2]],b[[2]]},{a[[3]],b[[3]]}}
> [...]
> I tried: Do[{{a[[i]],b[[i]]}},{i,3}] And it is not working.
>
> Since my first posting I found that Transpose[{a,b}] will do it.
>
> But I would like to know why the Do loop is not doing it !
>
> Thanks,
>
> Robert
I think your expectation about the behaviour of 'Do' is
wrong. From the description of 'Do':
"Unless an explicit Return is used, the value returned by Do
is Null."
What you propably wanted to use is 'Table'.
Rainer