如何不用prolog语言重复结果

时间:2017-05-11 17:48:31

标签: prolog

所以我在我的prolog程序中有这样的数据库,关于有名字的餐馆和在其中工作的人及其供应的餐点:

restaurant(hardees,[abo_abdo,abo_ahmad,tahseen],[grilled_chicken,jambo_beef,grilled_cheese_sandwich,roast_beef]).

restaurant(subway,[eftikar,tahseen,samer],[potato_salad,chicken_rice,jambo_beef,srevice_dish]).

restaurant(mcDonalds,[amer,zaher,maher],[service_dish,beef_stew,potato_corn,grilled_chicken,roast_beef]).

restaurant(kfc,[mufeed,mazen,izdihar,maher],[mushroom_rice,service_dish,jambo_beef]).

我想知道一家餐馆是否有一顿饭。

我有这条指令(这条指令应该只有一个参数):

multi_available(X):- restaurant(Y1,_,Z1),member(X,Z1),
restaurant(Y2,_,Z2),Y1 \= Y2 ,member(X,Z2).

并且它展示了这些结果:

multi_available(X).
X = grilled_chicken ;
X = jambo_beef ;
X = jambo_beef ;
X = roast_beef ;
X = jambo_beef ;
X = jambo_beef ;
X = service_dish ;
X = grilled_chicken ;
X = roast_beef ;
X = service_dish ;
X = jambo_beef ;
X = jambo_beef ;

如何在没有重复的情况下获得我的结果。 非常感谢

0 个答案:

没有答案