The most idiot programming language that I have ever seen: prolog

A test case can explain anything:

In abb.pl:

1
2
3
4
5
6
somefact(cs001).
anotherfact(cs000).
test(Course):-
not(somefact(Course))->false
;
anotherfact(Course).

 

The output likes following:

1
2
3
4
5
6
7
8
?- [abb].
true.

?- test(X).
X = cs000.

?- test(cs000).
false.

Basically speaking, I define a function test and ask prolog to find all X such that test(X) is true. However, when I test it back, it returns false.

This idiot bug makes my 10-hour work this night become a waste. I hate it.

发表评论

电子邮件地址不会被公开。 必填项已用*标注