I have to make a prolog program, and I have to find all combinations that meet those conditions:
... code... function(..., List), findall(clause, goal, C) where goal = (between(1,N,X), member(X, List))
I can't find out how to do it.
It can be with bagof too if anyone knows how.
findall(X, (between(1,N,X), member(X,List)), C)
. This will unify C with the list of numbers between 1 and N that are contained in List. – gusbrofindall/3
andbagof/3
. – gusbroL = []
:findall/3
will find[]
butbagof/3
will fail – false