Geoffrey Churchill : exactly what I meant. Thank you !
| Did you know ... | Search Documentation: |
| Predicate findall/3 |
[ISO]findall(+Template,
:Goal, -Bag)
findall/3
is equivalent to bagof/3
with all free variables appearing in Goal scoped to
the Goal with an existential (caret) operator (^),
except that bagof/3
fails when Goal has no solutions.
maplist(writeln, Bag) to explicitly write every solution, or execute set_prolog_flag(answer_write_options, [max_depth(1000)]). before your goal to increase the printing depth from 10 to 1000.
:- use_module(library(clpfd)).
play(J1,J2,NbJoeurs) :- Subb #= NbJoeurs -1, between(1,Subb ,J1), between(2,NbJoeurs,J2), J1 #< J2.
findall(play(X,Y), play(X,Y,6),Bag).
It does not print all solutions, there are ...
Bag = [play(1, 2), play(1, 3), play(1, 4), play(1, 5), play(1, 6), play(2, 3), play(2, 4), play(2, 5), play(..., ...)|...].
How to have all solutions ?
Notes about findall/3 ... how to use it etc.