There are several entry points provided for calling Prolog from Lisp. The main interface function is called logic
and has numerous options. The basic form is:
(logic <goal >
:return-type <return-type >
:all <all-type >
:bag-exp <bag-exp >)
The keyword arguments are interpreted as follows:
:return-type
describes what to do with a solution when one is found. Possible values of :return-type
are:
Display variable bindings and prompt user (the option used by the read-query-print
loop).
Instantiate the goal expression and return it.
Instantiate <bag-exp> and return it.
Return an alist of variables and bindings.
:all
tells what to do with multiple solutions. Possible values of :all
are:
Return the first solution.
Return multiple solutions as multiple values.
Return a list of the solutions.
:bag-exp
is an expression that should be instantiated with the bindings from a solution. This is only meaningful if :return-type
is :bag
.
KnowledgeWorks and Prolog User Guide (Windows version) - 24 Mar 2017