• 称谓平等/不平等

    纯粹的Prolog程序以干净的方式区分术语的相等和不平等会导致执行效率低下;即使所有相关性条款都成立了。 关于SO的最新示例就是这个答案。在这个定义中,所有答案和所有失败都是正确的。考虑: ?- Es = [E1,E2], occurrences(E, Es, Fs). Es = Fs, Fs = [E, E], E1 = E2, E2 = E ; Es = [E, E2], E1 = E, Fs = [E], dif(E, E2) ; Es = [E1, E], E2 = E, Fs = [E], dif...
  • Prolog中的逻辑“不”是什么?

    The problem that I face, is a bit trivial. I want to use logical not in Prolog, but it seems that not/1 is not the thing that I want: course(ai). course(pl). course(os). have(X,Y) :- course(X),course(Y),not(X = Y). 我查询: have(X,Y), write(X-Y), nl , fail. ...
公众号
码农俱乐部
关注公众号订阅更多技术干货!