Subject: Re: Need help in a not unifyable

From: Jan Wielemaker <[email-masked]>
Date: Tue, 16 May 2000 10:52:34 +0200

On Tue, 16 May 2000, Marcos Rebelo wrote:
>This is part of a code that I´m doing, when i try check(A,B) prolog gives
>no answer, the problem must be in the \== but I have alredy tried \=@=, \=,
>=\= and none worked.
>
>For example if I try to do "c \== _ cf _" gives NO but "c == _ cf _" also
>gives no. What is the problem here?
>
>:-op(950, xfx, cf).
>:-op(900, xfx, =>).

Operator precedence:

1 ?- op(950, xfx, cf).

Yes
2 ?- c \== _ cf _.
ERROR: Undefined procedure: (cf)/2

I.e. the precedence of cf > precedence of \== and therefore the
term is read as (c\==_) cf _.

Always think twice when defining new operators: should they be
used in conjunction with built-in's?  Are they likely to break
other code?

As of 3.3, operators are local to a module (unless defined in
the user module), so my advice is to use modules if you use
local operators to avoid messing up other code.

	Regards

		--- Jan