Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Get rid of onion-like parentheses

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37178] Re: Get rid of onion-like parentheses
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Tue, 15 Oct 2002 04:17:54 -0400 (EDT)
  • References: <aodnvf$mlm$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

JJJ,

Try:

  f[{x_}]:=x;
    f[{x_,y__}]:=x\[CircleTimes]y

Test

    f[{a,b,c,d}]

        a\[CircleTimes]b\[CircleTimes]c\[CircleTimes]d
--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"JJJ Shen" <jushen1 at hotmail.com> wrote in message
news:aodnvf$mlm$1 at smc.vnet.net...
> Hi,
> I was trying to write a function, when given a list, say, {a,b,c,d}, the
> output is a op b op c op d, where op is (in LaTeX) \bigotimes, or "esc c *
> esc" (\[CircleTimes]) in Mathematica.
>
> Here's the code I wrote:
> f[{x_}]:=x;
> f[{x_, y_, z___}]:=f[Join[{x\[CircleTimes]y},{z}]];
>
> However, the output was not exactly what I expected, it looked like:
>
> ((a op b) op c) op d
>
> It seems when doing the "Join" operation, a pair of parenthesis was added.
>
> Can someone let me know how I can get rid of these parenthesis?
>
> Thanks a lot.
>
> JT
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>




  • Prev by Date: Re: Table using as iterator a multiple of 10, 100, ...,10^n
  • Next by Date: Re: defining a function with D
  • Previous by thread: Re: Get rid of onion-like parentheses
  • Next by thread: Re: Get rid of onion-like parentheses