Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Simple list operation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45646] Re: Simple list operation
  • From: "Bo Le" <bole79 at email.si>
  • Date: Fri, 16 Jan 2004 19:58:05 -0500 (EST)
  • References: <bu8go7$aj8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Try transposing! Very elegantly:

Transpose[{{a, b, c}, {A, B, C}}]



bye,
Borut


"Dr. Wolfgang Hintze" <weh at snafu.de> wrote in message
news:bu8go7$aj8$1 at smc.vnet.net...
> 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: Re: List operation
  • Next by Date: Re: Simple list operation
  • Previous by thread: Fwd: Simple list operation
  • Next by thread: Re: Simple list operation