MathGroup Archive 1998

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

Search the Archive

Re: How: {{a,b},{1,2,3}} --> {{a,1},{b,2},{a,3}} ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14279] Re: How: {{a,b},{1,2,3}} --> {{a,1},{b,2},{a,3}} ?
  • From: dreissNOSPAM at nospam.earthlink.net (David Reiss)
  • Date: Mon, 12 Oct 1998 13:51:57 -0400
  • Organization: EarthLink Network, Inc.
  • References: <6vf5es$dha@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <6vf5es$dha at smc.vnet.net>, Michael Kubovy <mk9y at virginia.edu>
wrote:

> How do I get from {{a,b},{1,2,3}} to {{a,1},{b,2},{a,3}} ?
> 
> Thanks,
> |\  /|  / Michael Kubovy, Professor of Psychology, Dept of Psychology |
> \/ | /  Univ of Virginia, Gilmer Hall, Charlottesville, VA 22903-2477 |
> |/\  office (B011): 804-982-4729, lab (B019): -4751, fax: -4766  |    |
> \ HTTP://www.virginia.edu/~mklab/


This is an absolute kludge, but it does what you want:

In[1]:=
Flatten[(Outer[List,##]&@@{{a,b},{1,2,3}}),1][[{1,5,3}]]


Out[1]=
{{a,1},{b,2},{a,3}}

However, is your question more general than this?

Regards,

David

-- 
David Reiss
dreissNOSPAM at nospam.earthlink.net
To send personal email, remove the words  "nospam" and "NOSPAM" from the
email address


  • Prev by Date: Re: How to control the default plot size?
  • Next by Date: Re: Mouse is always a hand with Linux.
  • Previous by thread: ListPlot
  • Next by thread: Re: How: {{a,b},{1,2,3}} --> {{a,1},{b,2},{a,3}} ?