Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在通过提出一个非常简单的关于谁发送和接收电子邮件的数据库来练习 Prolog。
findall我已经使用预先指定的接收器创建了一个列表X。
findall
X
使用您的列表/2:
all_receivers(X,Uniques) :- findall(Y,(email(X,Y)),List),list(List,Uniques).
但最简单的方法是 sort/2,或者更好的 setof/3
all_receivers(X,List) :- setof(Y,X^(email(X,Y)),List).