Prolog \+ 和 \= 有什么区别

Prolog what's the difference between \+ and \=

\=和\+有什么区别?

因为

?- 15\=14.
?- \+ 15=14.<--- this gives an error while the above does not.

为什么?它们不一样吗?

编辑:这是错误:

Compiling the file:
D:\Program Files\Strawberry Prolog Beta\Games\WarCraft.pro
Warning 4: The string \+ is not an operator. (line 1, before the first clause)
Error 16: Instead of the integer 15 what is expected here is something like an infix operator or a full stop. (line 1, before the first clause)
1 error, 1 warning.

我也在用 Strawberry prolog 我也在 SWI prolog 上试过了,还是一样。

我认为您正在将查询放入 Prolog 源文件中。那不是他们应该去的地方:

  • 谓词定义 进入 Prolog 源文件
  • 查询 被输入交互式 Prolog 顶层

在没有输入文件的情况下尝试运行 SWI-Prolog 程序。您应该得到一个 window,其中包含一些关于 SWI-Prolog 版本的信息性消息,然后是一个提示 ?-。那是顶层。尝试在那里输入您的查询。所有查询都应该去那里。

我不知道 Strawberry Prolog,但我怀疑那里也一样。