簡體   English   中英

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.

另外,我使用的是草莓序言,我也在SWI序言中嘗試過。

我認為您正在將查詢放入Prolog源文件中。 那不是他們應該去的地方:

  • 謂詞定義進入Prolog源文件
  • 查詢被輸入到交互式Prolog頂層

嘗試在沒有輸入文件的情況下運行SWI-Prolog程序。 您應該獲得一個窗口,其中包含一些有關SWI-Prolog版本的信息性消息,然后出現提示?- 那是頂層。 嘗試在那里輸入查詢。 所有查詢都應該去那里。

我不了解Strawberry Prolog,但我懷疑那里是一樣的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM