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: List operation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45651] Re: List operation
  • From: jlgomezpardo at yahoo.es (J.L. G?mez Pardo)
  • Date: Fri, 16 Jan 2004 19:58:22 -0500 (EST)
  • References: <bu8j16$au9$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Dr. Wolfgang Hintze" <weh at snafu.de> wrote in message news:<bu8j16$au9$1 at smc.vnet.net>...
> Given two lists
> 
> In[7]:=
> x = {a, b, c}
> y = {A, B, C}
> 
> I'm looking for the list of pairs
> 
> z = {{a, A}, {b, B}, {c, C}}
> 
> Defining the function
> 
> In[5]:=
> paarweise[x_, y_, n_] := Table[{x[[i]], y[[i]]}, {i, 1, n}]
> 
> gives
> 
> In[6]:=
> z = paarweise[x, y, 3]
> 
> Out[6]=
> {{a, A}, {b, B}, {c, C}}
> 
> I'm sure there is a more elegant way to get such a list of pairs.
> Any help is appreciated.
> 
> Wolfgang Hintze


Try this: z = Thread[List[x,y]]

Regards,

Jose Luis.


  • Prev by Date: Re: Anyone using the Units package extensively?
  • Next by Date: Padding arrays with reversed elements
  • Previous by thread: Re: List operation
  • Next by thread: RE: List operation