Re: Operator precedence bug?

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Thu 15 Nov 2001 03:43:39 PM GMT
Message-ID: <3BF3E2AB.64844DFB@icparc.ic.ac.uk>
Yep, surprisingly it's all correct, and compatible with
"other" Prolog systems :-)


Warwick Harvey wrote:
> 
> [eclipse 4]: X = -3*2, X =.. L.
> 
> X = -3 * 2
> L = [*, -3, 2]
> Yes (0.00s cpu)
> [eclipse 5]: X = -2^9, X =.. L.
> 
> X = -2 ^ 9
> L = [^, -2, 9]
> Yes (0.00s cpu)
> 
> And it's not just that the minus is just being incorporated into the
> integer, either:
> 
> [eclipse 6]: X = - 2 ^ 9, X =.. L.
> 
> X = -2 ^ 9
> L = [^, -2, 9]
> Yes (0.00s cpu)

In all these cases the minus is part of the number,
not an operator.


> [eclipse 7]: X = -(2)^9, X =.. L.
> 
> X = (-(2)) ^ 9
> L = [^, -(2), 9]
> Yes (0.00s cpu)

Here it is also not an operator, just a normal functor.
(if you insert a blank after the minus, it is an operator
and does what you expect).


> 
> Parentheses also seem to have an effect:
> 
> [eclipse 4]: X = -Y^9, X =.. L.
> 
> Y = Y
> X = -(Y ^ 9)
> L = [-, Y ^ 9]
> Yes (0.00s cpu)

This is what you expect, right?


> [eclipse 7]: X = -(Y)^9, X=..L.
> 
> Y = Y
> X = (-(Y)) ^ 9
> L = [^, -(Y), 9]
> Yes (0.00s cpu)

Again, it's just a functor, not an operator.


-- Joachim
Received on Thu Nov 15 15:43:40 2001

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:11 PM GMT GMT