Such a question: Here I use a recursive search with a return, and I would like to remember the result of each found solution (for example, add to the list), which would then analyze these results. How can I arrange this?
It's just that the problem is that when we find one of the solutions and write the result (to the same list), we, since this is a return search, return to the part where it is possible to re-prove the rule, and the list to which we they brought the result of the decision, no matter how it was ... The phrase “We need a global variable” immediately comes to mind, and then programmers with an algorithmic mindset go into sadness, because there are no global variables in Prolog ... But how then to be?
By the way, I use PDC prolog.