1

运行此代码时:

signcheck(Sign1,Sign2):-(Sign1==clubs,Sign2==hearts);(Sign1==clubs,Sign2==spades)
                            ;(Sign1==clubs,Sign2==diamonds);(Sign1==hearts,Sign2==spades)
                            ;(Sign1==hearts,Sign2==diamonds);(Sign1==spades,Sign2==diamonds).
    lowercard(card(Num1,Sign1),card(Num2,_),card(Num1,Sign1)):- Num1<Num2.
    lowercard(card(Num1,Sign1),card(Num2,Sign2),card(Num1,Sign1)):- Num1==Num2,signcheck(Sign1,Sign2).
    lowercard(card(Num1,Sign1),card(Num2,Sign2),card(Num2,Sign2)):- Num1==Num2,signcheck(Sign2,Sign1).
    lowercard(card(Num1,_),card(Num2,Sign2),card(Num2,Sign2)):- Num1>Num2.
    lowest([card(X,Y)],card(X,Y)).
    lowest([X|XS],Z):- lowercard(X,Y,Z), lowest(XS,Y).

运行查询时:

lowest([card(5, hearts),card(4,diamonds)], X)

我收到此错误消息:

Arguments are not sufficiently instantiated
In:
   [3] 5<_1600
   [2] lowercard(card(5,hearts),card(_1668,_1670),card(5,hearts)) at  line 4
   [1] lowest([card(5,hearts),...],card(5,hearts)) at  line 8

为什么会出现这种情况?

4

1 回答 1

1

<除非实例化所有参数,否则无法计算算术运算(例如)。如果您的情况,右手参数(Num2看起来像)尚未实例化。

于 2021-01-19T16:52:00.830 回答