Re: lists
- To: mathgroup@smc.vnet.net
- Subject: [mg10554] Re: lists
- From: dreissNOSPAM@nospam.earthlink.net (David Reiss)
- Date: Tue, 20 Jan 1998 16:53:58 -0500
- Organization: EarthLink Network, Inc.
- References: <69nc3r$8bh@smc.vnet.net>
In article <69nc3r$8bh@smc.vnet.net>, Paul.Hanson@colorado.edu wrote:
> Hola!
> So, if you have a couple of lists:
> {{1},{2},{3},{4}....{n}}
> and
> {{1a},....{na}}
> and I want to combine them such that,
> {{1},{1a},{2},{2a}....{n},{na}}
>
> How do I get there? Thanks in advance for the help.
>
> Paul Hanson
>
> --
> * *
> * *
> /\ */\*
> / \ / \ /\
An example that shows the way to the general solution:
In[1]:=
temp1={{1},{2},{3},{4}}
Out[1]=
{{1},{2},{3},{4}}
In[2]:=
temp2={{a1},{a2},{a3},{a4}}
Out[2]=
{{a1},{a2},{a3},{a4}}
In[3]:=
Transpose[{temp1,temp2}]
Out[3]=
{{{1},{a1}},{{2},{a2}},{{3},{a3}},{{4},{a4}}}
In[4]:=
Flatten[Transpose[{temp1,temp2}],1]
Out[4]=
{{1},{a1},{2},{a2},{3},{a3},{4},{a4}}
--
David Reiss
dreissNOSPAM@nospam.earthlink.net
http://home.earthlink.net/~dreiss
To send personal email, remove the words "nospam" and "NOSPAM" from the
email address