2017-07-15 53 views

回答

1

因爲== checks term equality,而=\= checks arithmetical inequality。作爲爲p不是數字,Prolog的將其視爲一個算術表達式,試圖找出其算術值:

1 ?- p == 'p'.
true.

2 ?- p =/= 'p'.
ERROR: Syntax error: Operator expected
ERROR: p
ERROR: ** here **
ERROR: =/= 'p' .

2 ?- p =\= 'p'.
ERROR: =\=/2: Arithmetic: `p/0' is not a function

3 ?-

相關問題