A.1 library(aggregate): Aggregation operators on backtrackable predicates
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(aggregate): Aggregation operators on backtrackable predicates
          • aggregate/3
          • aggregate/4
          • aggregate_all/3
          • aggregate_all/4
          • foreach/2
          • free_variables/4
          • safe_meta/2
    • Packages
Availability::- use_module(library(aggregate)).(can be autoloaded)
Source[det]free_variables(:Generator, +Template, +VarList0, -VarList)
Find free variables in bagof/setof template. In order to handle variables properly, we have to find all the universally quantified variables in the Generator. All variables as yet unbound are universally quantified, unless

  1. they occur in the template
  2. they are bound by X^P, setof/3, or bagof/3

free_variables(Generator, Template, OldList, NewList) finds this set using OldList as an accumulator.

author
- Richard O'Keefe
- Jan Wielemaker (made some SWI-Prolog enhancements)
license
Public domain (from DEC10 library).
To be done
- Distinguish between control-structures and data terms.
- Exploit our built-in term_variables/2 at some places?