为什么无法运行此代码?ECLiPSe-clp中的“语法错误:期望后缀/中缀运算符”是什么错误

时间:2019-04-21 17:45:11

标签: prolog eclipse-clp

当我想在ECLiPSe-CLP中运行此代码时,出现以下错误

Error:
string stream 27: syntax error: postfix/infix operator expected

|     4 $= X^2 + Y^2,   (Error Mark is under '=')
|           

代码:

circles(X, Y) :-
    4 $= X^2 + Y^2,
    4 $= (X - 1)^2 + (Y - 1)^2,
    X $>= Y.

1 个答案:

答案 0 :(得分:0)

$=/2运算符/谓词是一个库谓词。您是否正在加载定义库?例如

[eclipse 12]: lib(ic).
...
Yes (0.12s cpu)

[eclipse 13]: [user].
circles(X, Y) :-
     4 $= X^2 + Y^2,
    4 $= (X - 1)^2 + (Y - 1)^2,
     X $>= Y.
 ^Dtty        compiled 4024 bytes in 0.00 seconds

Yes (0.00s cpu)

[eclipse 14]: circles(X, Y).

X = X{-1.0000000000000004 .. 2.0000000000000004}
Y = Y{-1.0000000000000004 .. 2.0000000000000004}

There are 13 delayed goals. Do you want to see them? (y/n)