MathGroup Archive 2007

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

Search the Archive

Re: Passing a list as seperate parameters?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73241] Re: Passing a list as seperate parameters?
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Thu, 8 Feb 2007 03:44:29 -0500 (EST)

On 2/7/07 at 5:06 AM, 4zumanga at gmail.com (Azumanga) wrote:

>As an example, I build up the list { {a,b},{c,d} }, and I want to
>find the union of it's elements.

>At first glance, I want Union. However, Union wants it's input as
>Union[{a,b},{c,d}], Union[{{a,b},{c,d}}] doesn't do anything.

Given what you've written above either

Union@Join[list1,list2]

or

Union@Flatten[{list1,list2}]

should do what you are asking for.

Note, for your specific example, all of the elements are unique.
And if order isn't important

Join[list1,list2]

will suffice
--
To reply via email subtract one hundred and four


  • Prev by Date: List manipulation
  • Next by Date: Sparse Arrays question
  • Previous by thread: Re: Passing a list as seperate parameters?
  • Next by thread: Re: Passing a list as seperate parameters?