Assuming the definitions for
from the previous examples.
|(any '(?x is the factorial of 5) '(fact 5 ?x))
|(120 IS THE FACTORIAL OF 5)
|(findall '(?x is a color) '(color ?x))
|((RED IS A COLOR) (BLUE IS A COLOR)
(GREEN IS A COLOR))
|(findall '?y '(or (= ?y 5) (= ?y 5)))
|(findallset '?y '(or (= ?y 5) (= ?y 5)))
will hang if a goal expression generates an infinite solution set.
More powerful all solution predicates (
) are available from within Common Prolog.
A different interface is available for predicates which will be called often from Lisp. The macro
may be used to generate normal Lisp functions that run with precompiled goals.