prolog - Check if any solution exists -


i have code in form

plan([],_). plan([ item | remainingitems ], groups) :-   dostuff(groups, item, updatedgroups),   rulesobeyed(updatedgroups),   plan(remainingitems, updatedgroups). 

dostuff have 1 possible sub tree, rulesobeyed can have endless based on number of groups rules can obeyed in several ways. results in plan returns same solutions on , over.

is there way like

solution_exists(rulesobeyed(updatedgroups)) 

so not take possible solutions rulesobeyed account?

the solution use once/1 - or \+ \+ false posted.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -