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

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -

Qt4: how to send QString inside a struct via QSharedMemory -