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
- they occur in the template
- 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?