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: [mg73214] Re: Passing a list as seperate parameters?
  • From: albert <awnl at arcor.de>
  • Date: Thu, 8 Feb 2007 03:30:24 -0500 (EST)
  • Organization: Arcor
  • References: <eqc71p$qs7$1@smc.vnet.net>

Hi,

> 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?

Does this what you want?

lst = {{a,b},{c,d}}
Union@@lst

@@ is a shortcut for Apply, which you can look up in the helpbrowser. 

hth,

albert


  • Prev by Date: DSolve y'[t]==y[t-a]
  • Next by Date: problem with 3D plot for CSV file
  • Previous by thread: Re: Passing a list as seperate parameters?
  • Next by thread: Re: Passing a list as seperate parameters?