Next Prev Up Top Contents Index

A.6.2.3 Example

(defun palindromep (x)
  (with-prolog
    (append ?a (?b . ?c) ?.x) ; note "?.x" reference
    (or (reverse ?a ?c)
        (reverse ?a (?b . ?c)))))
(palindromep '(yes no maybe))

returns:

NIL (palindromep '(yes no maybe no yes))

returns:

T

The body of a with-prolog returns t if it succeeds and a non-local exit is not executed. It returns nil on failure.


LispWorks KnowledgeWorks and Prolog User Guide - 14 Dec 2001

Next Prev Up Top Contents Index