1
votes

I'm trying to find a table of prolog operators explained. I found this: http://www.swi-prolog.org/pldoc/man?section=operators

But they are not explained. I'm looking more specifically for the meaning of:

\==, >>, <<

Subsidiary question:

I understand that \== is not evaluating the both term of the expression.

What would be the operators for having both term evaluated ? (similar to != in other languages..)

1

1 Answers

2
votes

Prolog operators are just syntactic sugar for ordinary prolog terms. The infix operator \== is the built-in predicate \==/2. See http://www.swi-prolog.org/pldoc/man?section=compare for details.

The infix operators << and >> are the built-in arithimetic functions <</2 and >>/2 respectively. See http://www.swi-prolog.org/pldoc/man?section=functions for details.

As far as a comparison operator that evaluated both the left- and right-hand sides as arithmetic expressions, you want =:=/2 and its converse =\=/2, which see documented at http://www.swi-prolog.org/pldoc/man?section=arith