Re: Passing a list as seperate parameters?

*To*: mathgroup at smc.vnet.net*Subject*: [mg73230] Re: [mg73194] Passing a list as seperate parameters?*From*: gardyloo <gardyloo at mail.wsu.edu>*Date*: Thu, 8 Feb 2007 03:38:46 -0500 (EST)*References*: <200702071006.FAA00361@smc.vnet.net>

Hi, 4zumanga, I'm not *entirely* sure what you're wanting here; you want {a,b} to be treated as an element on its own, so that, for example, {1,3} U {1,3} = {1,3}, and {1,3} U {2,3} = {{1,3}, {2, 3}} ? In that case, the Union provided by Mathematica 5.2 and 5.1 seem to work the way you want (and, in particular, the "nested list" as input seems to work fine). In your example, Union[ {{a,b}, {c,d}}] just returns {{a,b}, {c,d}}, but if you assign values to the letters (I did it in a With statement), and the values happen to be the same in the same positions in the subsets, then Union really does contract the list properly. Which version of Mathematica are you using? According to my documentation, Union was last changed in v. 3. Cheers, C.O. Azumanga 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? > > > > -- ========================================================== Curtis Osterhoudt gardyloo at mail.remove_this.wsu.and_this.edu PGP Key ID: 0x088E6D7A Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html ==========================================================

**References**:**Passing a list as seperate parameters?***From:*"Azumanga" <4zumanga@gmail.com>