Prolog: store solutions in a list -
this simple question ;)
fact(a).
fact(b).
test(x):-fact(x).
the solutions x=a; x=b. ok
i'm trying create: test(x,l):-fact(x), ??? returns l=[a,b]
can me? thanks.
use findall/3
aggregate solutions:
test(l):- findall(x, fact(x), l).
Comments
Post a Comment