lectures(monday, nolecture).
lectures(tuesday, vp).
lectures(tuesday, se).
lectures(tuesday, ddbms).
lectures(wednessday, ds).
lectures(wednessday, mpl).
lectures(thursday, vp).
lectures(thrusday, se).
lectures(friday, ds).
lectures(friday, mpl).
lectures(saturday, ai).
lectures(saturday, ddbms).

?- lectures(friday, X), write(X),nl.


查询仅将第一条记录打印为ds,我想在特定日期(即星期五)打印所有记录,结果应为ds和mpl。

告诉我!

最佳答案

fail.添加到查询的末尾:

| ?- lectures(friday, X), write(X), nl, fail.
ds
mpl

no
| ?-


另请参见this very similar question,因此在提出新问题之前,请尝试多使用搜索功能。

10-06 09:06