A.6 Calling Prolog From Lisp

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.

The default is :fill .

: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 .

A.6.1 Examples

A.6.2 Interface Functions

KnowledgeWorks and Prolog User Guide (Macintosh version) - 11 Jul 2006