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


A.5 Accessing Lisp From Common Prolog

It is apparent from the Common Prolog syntax that the first element of any valid goal expression must be a symbol. Common Prolog takes advantage of this fact and gives a special interpretation to a goal with a list in the first position. A list in the car of a goal is treated as a Lisp expression with normal Lisp evaluation rules. Any logic variables in the expression are instantiated with their values. (They must be bound). The rest of the goal expression should be a list of expressions to be unified with the values returned by the Lisp evaluation. Any extra values returned are ignored, and any extra expressions in the tail of a goal are unified with new unbound variables.

A.5.1 Examples

KnowledgeWorks and Prolog User Guide (Unix version) - 24 Mar 2017