4.30 Finding all Solutions to a Goal
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Finding all Solutions to a Goal
          • findall/3
          • findall/4
          • findnsols/4
          • findnsols/5
          • bagof/3
          • setof/3
    • Packages
Availability:built-in
Source[ISO]findall(+Template, :Goal, -Bag)
Create a list of the instantiations Template gets successively on backtracking over Goal and unify the result with Bag. Succeeds with an empty list if Goal has no solutions.

findall/3 is equivalent to bagof/3 with all free variables appearing in Goal scoped to the Goal with an existential (caret) operator (^), except that bagof/3 fails when Goal has no solutions.