I'm trying to solve a problem in SWI-Prolog. I have a list of suitable elements (constants) obtained with.
suitables(L) :- setof(X, isSuitable(X), L).
Each element from above has a score via a functor, and I need all the subsets that have a score > 10. I know how to get the score sum:
scoreSum([], 0).
scoreSum([H,T], Tot) :- getScore(H,F),scoreSum(T, Rest), Tot is F+Rest.
And the condition can be expressed like this:
cond(L) :- scoreSum(L, R), R > 10.
How do I get all the subsets matching the given condition? I can get the subsets based on the answer here, but how do I iterate over that result to get only the subsets matching the condition?