Re: List operation
- To: mathgroup at smc.vnet.net
- Subject: [mg45620] Re: [mg45617] List operation
- From: George Woodrow III <georgevw3 at mac.com>
- Date: Fri, 16 Jan 2004 19:56:57 -0500 (EST)
- References: <200401161105.GAA10749@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Transpose[{x,y}] does the trick. george On 16 Jan, 2004, at 6:05 am, Dr. Wolfgang Hintze wrote: > 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 >
- References:
- List operation
- From: "Dr. Wolfgang Hintze" <weh@snafu.de>
- List operation