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: [mg73247] Re: [mg73194] Passing a list as seperate parameters?
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 8 Feb 2007 03:47:37 -0500 (EST)
  • Reply-to: hanlonr at cox.net

m={{c,d},{a,b},{e,e},{c,d}};

Union[m]

{{a,b},{c,d},{e,e}}

Union@@m

{a,b,c,d,e}

Union/@m

{{c,d},{a,b},{e},{c,d}}


Bob Hanlon

---- Azumanga <4zumanga at gmail.com> wrote: 
> I have a recuring problem in using mathematica, which I'm sure there
> must be a simple fix for, but I've looked through the manual and can't
> find it.
> 
> 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.
> 
> In general I get around this by fold, but it seems there should be a
> simpler method?
> 


  • Prev by Date: Re: Passing a list as seperate parameters?
  • Next by Date: Re: Passing a list as seperate parameters?
  • Previous by thread: Re: Passing a list as seperate parameters?
  • Next by thread: Re: Passing a list as seperate parameters?