prologprolog-setof

How to choose between bagof, setof and findall in Prolog


How does one choose between bagof, setof and findall? Are there any important differences? Which is most commonly used and which is the safest? Thanks for your comments/answers.

I checked the SWI-Prolog manual page on findall/3 and found them to be very similar.


Solution

  • That's a great question!

    I am not attempting to give an exhaustive answer, but I would like to suggest a few lines of thought that can help you to understand these predicates better:

    In addition, I recommend you read Richard O'Keefe's book The Craft of Prolog for valuable information about these predicates.