如何避免在PROLOG中重复答案

时间:2017-06-13 11:19:13

标签: prolog

这是我的问题:

?- rule7(X,Y,t3).

X = s10,
Y = s11 ;
X = s12,
Y = s10 ;
X = s12,
Y = s10 ;
X = s12,
Y = s11 ;
X = s12,
Y = s11 ;
X = s12,
Y = s13 ;
X = s12,
Y = s13 .....

它会重复很多次。我怎样才能减少这些重复...

守则:

rule7(X,Y,T) :-
  course(C,X),
  course(C1,Y),
  course_lec(C1,T),
  course_lec(C,T),
  copy_rec(Y,X).

0 个答案:

没有答案