Should ^^ (opPow) be left- or right-associative?
Nick Sabalausky
a at a.a
Sat Dec 5 13:46:40 PST 2009
"Don" <nospam at nospam.com> wrote in message
news:hfei3u$kvk$1 at digitalmars.com...
> bearophile wrote:
>> KennyTM~:
>>> But the mathematical convention is a^b^c == a^(b^c).
>>> Languages which the power operator is right-associative (3^3^3==7e12):
>>> - Python, Haskell, Ruby, Perl, Mathematica, Bash.
>>
>> Doing things as in mathematical convention, Mathematica and Python sounds
>> better.
>> This was just the release V.0.1 of the built-in pow, it needs several
>> improvements :-)
>>
>> Bye,
>> bearophile
>
> Fortran too.
> Here's a link from the TCL language, with a nice explanation of the
> rationale for choosing right associativity.
>
> http://www.tcl.tk/cgi-bin/tct/tip/274.html
Quick summary for those who don't want to dig through that whole page:
(a ^^ b) ^^ c == a ^^ (b * c) <-- For all real values of a, b, and c
So kinda useless, but...
a ^^ (b ^^ c) == .... a ^^ (b ^^ c)
So more useful.
More information about the Digitalmars-d
mailing list