MathGroup Archive 2002

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

Search the Archive

Re: combining lists


In a message dated 1/19/02 8:07:49 PM, hvdosten at lb.netic.de writes:

>because I feel that I am again and again starting at the same point
>after a while, just a short question.
>
>How can I combine two lists, say:
>
>list1={{x1,y1},{x2,y2},...,{nx,ny}} and
>list2={{a1,b1},{a2,b2},...,{an,bn}}
>
>so that the combination would be:
>
>combined={{{x1,y1},{a1,b1}},{{x2,y2},{a2,b2}},....,{{xn,yn},{an,bn}}}
>
>I tried something like
>
>combi=Join[Take[#2]&,  list1,  Take[#,2]&,  list2]
>
>cimbined=Partition[combi,2]
>
>but without any success. I am sure it is easy but ....

Transpose[{list1, list2}]

or

Thread[{list1, list2}]


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: parameter restrictions
  • Next by Date: Re: combining lists
  • Previous by thread: combining lists
  • Next by thread: Re: combining lists