Reputation: 29
This is a very simple question ;)
fact(a).
fact(b).
test(X):-fact(X).
the solutions are X=a; X=b. OK
I'm trying to create: test(X,L):-fact(X), ??? that returns L=[a,b]
can someone help me? Thanks.
Upvotes: 0
Views: 299
Reputation: 22585
Use findall/3 to aggregate solutions:
findall/3
test(L):- findall(X, fact(X), L).
Upvotes: 2