Domanda

I'm practicing Prolog by coming up with a very simple database of who has sent and received emails.

I have created a list using findall of the receivers of a pre-specified X.

È stato utile?

Soluzione

to use your list/2:

all_receivers(X,Uniques) :- findall(Y,(email(X,Y)),List),list(List,Uniques).

but the easiest way is sort/2, or better setof/3

all_receivers(X,List) :- setof(Y,X^(email(X,Y)),List).
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top