A final interface mechanism is
with-prolog. with-prolog allows one to embed prolog into an arbitrary lisp function. Lisp variables are referenced in Prolog using "
(defun palindromep (x)
(append ?a (?b . ?c) ?.x) ; note "?.x" reference
(or (reverse ?a ?c)
(reverse ?a (?b . ?c)))))
(palindromep '(yes no maybe))
(palindromep '(yes no maybe no yes))
The body of a
t if it succeeds and a non-local exit is not executed. It returns
nil on failure.
KnowledgeWorks and Prolog User Guide (Unix version) - 24 Mar 2017