Next Prev Up Top Contents Index

A.6.2.2 Example

(deflogfun break-up (y) (append ?a ?b y) (?a ?b))

then:

(break-up '(foo bar baz))

returns:

(NIL (FOO BAR BAZ))
T
(break-up '(foo bar baz) :all :values)

returns:

(NIL (FOO BAR BAZ))
((FOO) (BAR BAZ))
((FOO BAR) (BAZ))
((FOO BAR BAZ) NIL)
(break-up '(foo bar baz) :all :list)

returns:

((NIL (FOO BAR BAZ))
 ((FOO) (BAR BAZ))
 ((FOO BAR) (BAZ))
 ((FOO BAR BAZ) NIL))
T

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 " ?.< name > ".


LispWorks KnowledgeWorks and Prolog User Guide - 14 Dec 2001

Next Prev Up Top Contents Index