All Manuals > KnowledgeWorks and Prolog User Guide > A Common Prolog

NextPrevUpTopContentsIndex

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

Display variable bindings and prompt user (the option used by the read-query-print loop).

:fill

Instantiate the goal expression and return it.

:bag

Instantiate <bag-exp> and return it.

:alist

Return an alist of variables and bindings.

The default is :fill.

:all tells what to do with multiple solutions. Possible values of :all are:

nil

Return the first solution.

:values

Return multiple solutions as multiple values.

:list

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) - 26 Feb 2015

NextPrevUpTopContentsIndex