Prefix negation

Pixel pixel@mandrakesoft.com
Wed, 29 Aug 2001 19:54:37 +0200 (CEST)


"Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl> writes:

> Wed, 29 Aug 2001 16:34:52 +0200, Rijk-Jan van Haaften <rjchaaft@cs.uu.nl> pisze:
> 
> > -3 ^ 2 = -9
> > 
> > In most programming languages as well as in mathematics
> > it is quite unusual to have infix operators with a higher
> > priority than prefix operators.
> 
> I agree that many languages got it wrong :-)

many languages have it the haskell way:

-9: perl, ruby, python, haskell
 9: ocaml

> In mathematics the prefix negation is handled like in Haskell:
> 
>       2
>     -3  = -9

 -3^2  = -9  doesn't bother me
-3 ^ 2 = -9  do bother me :-(