AW: Simple list operation

• To: mathgroup at smc.vnet.net
• Subject: [mg45619] AW: [mg45579] Simple list operation
• From: Matthias.Bode at oppenheim.de
• Date: Fri, 16 Jan 2004 19:56:56 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Hello Wolfgang,

try:

x = {a, b, c};
y = {A, B, C};
Partition[Sort[Join[x, y]], 2]

Output:

{{a, A}, {b, B}, {c, C}}

Best regards,
Matthias Bode
Sal. Oppenheim jr. & Cie. KGaA
Koenigsberger Strasse 29
D-60487 Frankfurt am Main
GERMANY
Tel.: +49(0)69 71 34 53 80
Mobile: +49(0)172 6 74 95 77
Fax: +49(0)69 71 34 95 380
E-mail: matthias.bode at oppenheim.de
Internet: http://www.oppenheim.de

-----UrsprÃ¼ngliche Nachricht-----
Von: Dr. Wolfgang Hintze [mailto:weh at snafu.de]
Gesendet: Freitag, 16. Januar 2004 12:05
An: mathgroup at smc.vnet.net
Betreff: [mg45579] Simple list operation

Given two lists

In[10]:=
x = {a, b, c};

In[11]:=
y = {A, B, C};

how can I get the list of pairs

p={{a,A},{b,B},{c,C}}?

I have used a brute force method like

In[9]:=
p = Table[ {x[[i]], y[[i]]}, {i, 1, 3}]

Out[9]=
{{a, A}, {b, B}, {c, C}}

but I'm sure there is a much more elegant way.
Any hint is greatly appreciated.

Wolfgang

```

• Prev by Date: Fwd: using functions with package name prefixed.
• Next by Date: Re: using functions with package name prefixed.