I would like to get a list of solutions from a rule I made in Prolog.
However the findall predicate appears to only work with one variable.
Can anyone suggest how to get around this apparent limitation?
My rule
beat(P,M,E)
What I want
L = [[P,M],[P,M],................]
What I get now
L = [P,P,P,P,.........]
or
L = [M,M,M,M,M.............]
findall
can work with a surprisingly flexible amount of variations. I think you want something like this:
findall([P,M], beat(P,M,E), L).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With