This is the paiprolog Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 06:17:46 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
paiprolog
package.lisp
(file).
auxfns.lisp
(file).
patmatch.lisp
(file).
unify.lisp
(file).
prolog.lisp
(file).
prologc.lisp
(file).
prologcp.lisp
(file).
prolog-ext.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
paiprolog/paiprolog.asd
paiprolog/package.lisp
paiprolog/auxfns.lisp
paiprolog/patmatch.lisp
paiprolog/unify.lisp
paiprolog/prolog.lisp
paiprolog/prologc.lisp
paiprolog/prologcp.lisp
paiprolog/prolog-ext.lisp
paiprolog/auxfns.lisp
package.lisp
(file).
paiprolog
(system).
binding-val
(function).
binding-var
(function).
clear-memoize
(function).
compose
(function).
dbg
(function).
dbg-indent
(function).
debug
(function).
define-enumerated-type
(macro).
defresource
(macro).
defun-memo
(macro).
delay
(macro).
delay
(structure).
dequeue
(function).
empty-queue-p
(function).
enqueue
(function).
extend-bindings
(function).
fail
(constant).
find-all
(function).
find-anywhere
(function).
find-if-anywhere
(function).
first-or-nil
(function).
first-or-self
(function).
flatten
(function).
force
(function).
front
(function).
funcall-if
(macro).
get-binding
(function).
last1
(function).
length=1
(function).
lookup
(function).
make-binding
(function).
make-queue
(function).
mappend
(function).
match-variable
(function).
maybe-add
(function).
maybe-set-fill-pointer
(function).
member-equal
(function).
memo
(function).
memoize
(function).
mklist
(function).
new-symbol
(function).
no-bindings
(constant).
not-null
(function).
once-only
(macro).
partition-if
(function).
queue-contents
(function).
queue-nconc
(function).
random-elt
(function).
read-time-case
(macro).
rest2
(function).
rest3
(function).
reuse-cons
(function).
seq-ref
(function).
side-effect-free?
(function).
sort*
(function).
starts-with
(function).
symbol
(function).
undebug
(function).
unique-find-if-anywhere
(function).
with-resource
(macro).
*dbg-ids*
(special variable).
copy-delay
(function).
delay-computed?
(reader).
(setf delay-computed?)
(writer).
delay-p
(function).
delay-value
(reader).
(setf delay-value)
(writer).
make-delay
(function).
paiprolog/patmatch.lisp
package.lisp
(file).
paiprolog
(system).
pat-match
(function).
variable-p
(function).
expand-pat-match-abbrev
(function).
first-match-pos
(function).
match-and
(function).
match-if
(function).
match-is
(function).
match-not
(function).
match-or
(function).
pat-match-abbrev
(function).
rule-based-translator
(function).
segment-match
(function).
segment-match+
(function).
segment-match-fn
(function).
segment-match?
(function).
segment-matcher
(function).
segment-pattern-p
(function).
single-match-fn
(function).
single-matcher
(function).
single-pattern-p
(function).
paiprolog/unify.lisp
package.lisp
(file).
auxfns.lisp
(file).
patmatch.lisp
(file).
paiprolog
(system).
*occurs-check*
(special variable).
occurs-check
(function).
subst-bindings
(function).
unifier
(function).
unify
(function).
unify-variable
(function).
paiprolog/prolog.lisp
package.lisp
(file).
unify.lisp
(file).
paiprolog
(system).
?-
(macro).
*db-predicates*
(special variable).
clause-body
(function).
clause-head
(function).
clear-db
(function).
clear-predicate
(function).
continue-p
(function).
find-anywhere-if
(function).
get-clauses
(function).
non-anon-variable-p
(function).
predicate
(function).
prove
(function).
prove-all
(function).
rename-variables
(function).
replace-?-vars
(function).
show-prolog-vars
(function).
unique-find-anywhere-if
(function).
variables-in
(function).
paiprolog/prologc.lisp
package.lisp
(file).
prolog.lisp
(file).
paiprolog
(system).
<-
(macro).
?
(function).
print-object
(method).
var
(structure).
*predicate*
(special variable).
*trail*
(special variable).
*uncompiled*
(special variable).
*var-counter*
(special variable).
add-clause
(function).
anon-vars-in
(function).
anonymous-variables-in
(function).
args
(function).
bind-new-variables
(function).
bind-unbound-vars
(function).
bind-variables-in
(function).
bound-p
(function).
clauses-with-arity
(function).
compile-arg
(function).
compile-body
(function).
compile-call
(function).
compile-clause
(function).
compile-if
(function).
compile-predicate
(function).
compile-unify
(function).
compile-unify-variable
(function).
copy-var
(function).
def-prolog-compiler-macro
(macro).
deref
(macro).
deref-exp
(function).
destructure-if-then-else
(function).
follow-binding
(function).
goal-and-p
(function).
goal-conjunction-p
(function).
goal-cut-p
(function).
goal-disjunction-p
(function).
goal-if-p
(function).
goal-if-then-else-p
(function).
goal-if-then-p
(function).
goal-or-p
(function).
has-variable-p
(function).
ignore
(function).
make-=
(function).
make-anonymous
(function).
make-parameters
(function).
make-predicate
(function).
maybe-add-undo-bindings
(function).
print-var
(function).
prolog-compile
(function).
prolog-compile-symbols
(function).
prolog-compiler-macro
(function).
proper-listp
(function).
relation-arity
(function).
retract-clause
(function).
run-prolog
(function).
self-cons
(function).
set-binding!
(function).
show-prolog-vars/2
(function).
top-level-prove
(function).
unbound
(constant).
undo-bindings!
(function).
unify!
(function).
var-binding
(reader).
(setf var-binding)
(writer).
var-name
(reader).
(setf var-name)
(writer).
var-p
(function).
paiprolog/prologcp.lisp
package.lisp
(file).
auxfns.lisp
(file).
prologc.lisp
(file).
paiprolog
(system).
!/0
(function).
</2
(function).
=..
(function).
=/2
(function).
=∶=/2
(function).
=</2
(function).
==/2
(function).
=\=/2
(function).
>/2
(function).
>=/2
(function).
@</2
(function).
@=</2
(function).
@>/2
(function).
@>=/2
(function).
\=/2
(function).
\==/2
(function).
abolish/1
(function).
arg/3
(function).
asserta/1
(function).
assertz/1
(function).
at-end-of-stream/0
(function).
at-end-of-stream/1
(function).
atom-characters/2
(function).
atom-chars/2
(function).
atom-codes/2
(function).
atom-concat/3
(function).
atom-length/2
(function).
atom/1
(function).
atomic/1
(function).
atomicp
(function).
bagof/3
(function).
ball
(reader method).
call/1
(function).
catch/3
(function).
char-code/2
(function).
clause/2
(function).
close/1
(function).
close/2
(function).
compound/1
(function).
copy-term/2
(function).
current-input/1
(function).
current-output/1
(function).
current-predicate/1
(function).
deref-copy
(function).
deref-equal
(function).
explode
(function).
fail-if/1
(function).
fail/0
(function).
findall/3
(function).
flush-output/0
(function).
flush-output/1
(function).
functor/3
(function).
get-char/1
(function).
get-char/2
(function).
get-code/1
(function).
get-code/2
(function).
implode
(function).
integer/1
(function).
is/2
(function).
make-renamed-copy
(function).
nl/0
(function).
nl/1
(function).
nonvar/1
(function).
nonvarp
(function).
number-chars/2
(function).
number-codes/2
(function).
number/1
(function).
once/1
(function).
open/4
(function).
prolog-throw
(condition).
put-char/1
(function).
put-char/2
(function).
put-code/1
(function).
put-code/2
(function).
read/1
(function).
real/1
(function).
repeat/0
(function).
retract/1
(function).
set-input/1
(function).
set-output/1
(function).
set-stream-position/2
(function).
setof/3
(function).
string-atom/2
(function).
string-list/2
(function).
sub-atom/4
(function).
term-precedes
(function).
throw/1
(function).
true/0
(function).
unbound-var-p
(function).
unify-with-occurs-check/2
(function).
var/1
(function).
with-stream
(macro).
with-undo-bindings
(macro).
write/1
(function).
paiprolog/prolog-ext.lisp
prologc.lisp
(file).
paiprolog
(system).
<--
(macro).
prolog
(macro).
prolog-collect
(macro).
prolog-first
(macro).
insert-deref
(function).
prolog-translate-goals
(function).
retract-same-arity-clause
(function).
Packages are listed by definition order.
paiprolog
common-lisp
.
paiprolog.auxfns
.
<-
(macro).
<--
(macro).
?
(function).
?-
(macro).
prolog
(macro).
prolog-collect
(macro).
prolog-first
(macro).
var
(structure).
!/0
(function).
*db-predicates*
(special variable).
*occurs-check*
(special variable).
*predicate*
(special variable).
*trail*
(special variable).
*uncompiled*
(special variable).
*var-counter*
(special variable).
</2
(function).
=..
(function).
=/2
(function).
=∶=/2
(function).
=</2
(function).
==/2
(function).
=\=/2
(function).
>/2
(function).
>=/2
(function).
@</2
(function).
@=</2
(function).
@>/2
(function).
@>=/2
(function).
\=/2
(function).
\==/2
(function).
abolish/1
(function).
add-clause
(function).
anon-vars-in
(function).
anonymous-variables-in
(function).
arg/3
(function).
args
(function).
asserta/1
(function).
assertz/1
(function).
at-end-of-stream/0
(function).
at-end-of-stream/1
(function).
atom-characters/2
(function).
atom-chars/2
(function).
atom-codes/2
(function).
atom-concat/3
(function).
atom-length/2
(function).
atom/1
(function).
atomic/1
(function).
atomicp
(function).
bagof/3
(function).
ball
(generic reader).
bind-new-variables
(function).
bind-unbound-vars
(function).
bind-variables-in
(function).
bound-p
(function).
call/1
(function).
catch/3
(function).
char-code/2
(function).
clause-body
(function).
clause-head
(function).
clause/2
(function).
clauses-with-arity
(function).
clear-db
(function).
clear-predicate
(function).
close/1
(function).
close/2
(function).
compile-arg
(function).
compile-body
(function).
compile-call
(function).
compile-clause
(function).
compile-if
(function).
compile-predicate
(function).
compile-unify
(function).
compile-unify-variable
(function).
compound/1
(function).
continue-p
(function).
copy-term/2
(function).
copy-var
(function).
current-input/1
(function).
current-output/1
(function).
current-predicate/1
(function).
def-prolog-compiler-macro
(macro).
deref
(macro).
deref-copy
(function).
deref-equal
(function).
deref-exp
(function).
destructure-if-then-else
(function).
expand-pat-match-abbrev
(function).
explode
(function).
fail-if/1
(function).
fail/0
(function).
find-anywhere-if
(function).
findall/3
(function).
first-match-pos
(function).
flush-output/0
(function).
flush-output/1
(function).
follow-binding
(function).
functor/3
(function).
get-char/1
(function).
get-char/2
(function).
get-clauses
(function).
get-code/1
(function).
get-code/2
(function).
goal-and-p
(function).
goal-conjunction-p
(function).
goal-cut-p
(function).
goal-disjunction-p
(function).
goal-if-p
(function).
goal-if-then-else-p
(function).
goal-if-then-p
(function).
goal-or-p
(function).
has-variable-p
(function).
ignore
(function).
implode
(function).
insert-deref
(function).
integer/1
(function).
is/2
(function).
make-=
(function).
make-anonymous
(function).
make-parameters
(function).
make-predicate
(function).
make-renamed-copy
(function).
match-and
(function).
match-if
(function).
match-is
(function).
match-not
(function).
match-or
(function).
maybe-add-undo-bindings
(function).
nl/0
(function).
nl/1
(function).
non-anon-variable-p
(function).
nonvar/1
(function).
nonvarp
(function).
number-chars/2
(function).
number-codes/2
(function).
number/1
(function).
occurs-check
(function).
once/1
(function).
open/4
(function).
pat-match-abbrev
(function).
predicate
(function).
print-var
(function).
prolog-compile
(function).
prolog-compile-symbols
(function).
prolog-compiler-macro
(function).
prolog-throw
(condition).
prolog-translate-goals
(function).
proper-listp
(function).
prove
(function).
prove-all
(function).
put-char/1
(function).
put-char/2
(function).
put-code/1
(function).
put-code/2
(function).
read/1
(function).
real/1
(function).
relation-arity
(function).
rename-variables
(function).
repeat/0
(function).
replace-?-vars
(function).
retract-clause
(function).
retract-same-arity-clause
(function).
retract/1
(function).
rule-based-translator
(function).
run-prolog
(function).
segment-match
(function).
segment-match+
(function).
segment-match-fn
(function).
segment-match?
(function).
segment-matcher
(function).
segment-pattern-p
(function).
self-cons
(function).
set-binding!
(function).
set-input/1
(function).
set-output/1
(function).
set-stream-position/2
(function).
setof/3
(function).
show-prolog-vars
(function).
show-prolog-vars/2
(function).
single-match-fn
(function).
single-matcher
(function).
single-pattern-p
(function).
string-atom/2
(function).
string-list/2
(function).
sub-atom/4
(function).
subst-bindings
(function).
term-precedes
(function).
throw/1
(function).
top-level-prove
(function).
true/0
(function).
unbound
(constant).
unbound-var-p
(function).
undo-bindings!
(function).
unifier
(function).
unify
(function).
unify!
(function).
unify-variable
(function).
unify-with-occurs-check/2
(function).
unique-find-anywhere-if
(function).
var-binding
(reader).
(setf var-binding)
(writer).
var-name
(reader).
(setf var-name)
(writer).
var-p
(function).
var/1
(function).
variables-in
(function).
with-stream
(macro).
with-undo-bindings
(macro).
write/1
(function).
paiprolog.auxfns
common-lisp
.
binding-val
(function).
binding-var
(function).
clear-memoize
(function).
compose
(function).
dbg
(function).
dbg-indent
(function).
debug
(function).
define-enumerated-type
(macro).
defresource
(macro).
defun-memo
(macro).
delay
(macro).
delay
(structure).
dequeue
(function).
empty-queue-p
(function).
enqueue
(function).
extend-bindings
(function).
fail
(constant).
find-all
(function).
find-all-if
(function).
find-anywhere
(function).
find-if-anywhere
(function).
first-or-nil
(function).
first-or-self
(function).
flatten
(function).
force
(function).
front
(function).
funcall-if
(macro).
get-binding
(function).
last1
(function).
length=1
(function).
lookup
(function).
make-binding
(function).
make-queue
(function).
mappend
(function).
match-variable
(function).
maybe-add
(function).
maybe-set-fill-pointer
(function).
member-equal
(function).
memo
(function).
memoize
(function).
mklist
(function).
new-symbol
(function).
no-bindings
(constant).
not-null
(function).
once-only
(macro).
partition-if
(function).
pat-match
(function).
queue-contents
(function).
queue-nconc
(function).
random-elt
(function).
read-time-case
(macro).
rest2
(function).
rest3
(function).
reuse-cons
(function).
seq-ref
(function).
side-effect-free?
(function).
sort*
(function).
starts-with
(function).
symbol
(function).
undebug
(function).
unique-find-if-anywhere
(function).
variable-p
(function).
with-resource
(macro).
*dbg-ids*
(special variable).
copy-delay
(function).
delay-computed?
(reader).
(setf delay-computed?)
(writer).
delay-p
(function).
delay-value
(reader).
(setf delay-value)
(writer).
make-delay
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Add a clause to the data base.
Retract a same arity clause from the data base, and add a clause to the data base.
Represent an enumerated type with integers 0-n.
Define a memoized function.
A computation that can be executed later by FORCE.
Returns the code built by BODY. If any of VARIABLES might have side effects, they are evaluated once and stored in temporary variables that are then passed to BODY.
Run Prolog in the surrounding Lisp environment which is accessed from lisp functor.
collect all bindings of vars
return first bindding of vars
Do the first case, where normally cases are specified with #+ or possibly #- marks.
Execute body with VAR bound to an instance of RESOURCE.
Get the value part of a single binding.
Get the variable part of a single binding.
Clear the hash table from a memo function.
Print debugging info if (DEBUG ID) has been specified.
Print indented debugging info if (DEBUG ID) has been specified.
Start dbg output on the given ids.
Remove an item from the front of the queue.
Insert item at the end of the queue.
Add a (var . value) pair to a binding list.
Find all those elements of sequence that match item, according to the keywords. Doesn’t alter sequence.
Return a copy of sequence with elements not satisfying PREDICATE removed.
remove-if-not
.
Does item occur anywhere in tree?
Does predicate apply to any atom in the tree?
The first element of x if it is a list; else nil.
The first element of x, if it is a list; else x itself.
Get rid of imbedded lists (to one level only).
Do a delayed computation, or fetch its previously-computed value.
Find a (variable . value) pair in a binding list.
Return the last element (not last cons cell) of list
Is x a list of length 1?
Get the value part (for var) from a binding list.
Build a new queue, with no elements.
Append the results of calling fn on each element of list. Like mapcon, but uses append instead of nconc.
Does VAR match input? Uses (or updates) and returns bindings.
For example, (maybe-add ’and exps t) returns
t if exps is nil, exps if there is only one,
and (and exp1 exp2...) if there are several exps.
If this is an array with a fill pointer, set it to new-length, if that is longer than the current length.
Return a memo-function of fn.
Replace fn-name’s global definition with a memoized version.
If x is a list return it, otherwise return the list of x
Concatenate symbols or strings to form an uninterned symbol
Return 2 values: elements of list that satisfy pred, and elements that don’t.
Match pattern against input in the context of the bindings
Add the elements of LIST to the end of the queue.
Pick a random element out of a sequence.
The rest of a list after the first TWO elements.
The rest of a list after the first THREE elements.
Return (cons x y), or reuse x-y if it is equal to (cons x y)
Return code that indexes into a sequence, using the pop-lists/aref-vectors strategy.
Is exp a constant, variable, or function,
or of the form (THE type x) where x is side-effect-free?
Sort without altering the sequence
Is x a list whose first element is x?
Concatenate symbols or strings to form an interned symbol
Stop dbg on the ids. With no ids, stop dbg altogether.
Return a list of leaves of tree satisfying predicate, with duplicates removed.
Is x a variable (a symbol beginning with ‘?’)?
a list of all predicates stored in the database.
Identifiers used by dbg
Should we do the occurs check?
The Prolog predicate currently being compiled
Prolog symbols that have not been compiled.
Define a compiler macro for Prolog.
Follow pointers for bound variables.
Undo bindings after each expression in body except the last.
7.8.4
8.7.3
8.2.1
8.7.3
8.7.3
8.4.1: Are the two arguments EQUAL with no unification, but with dereferencing? If so, succeed.
8.7.3
8.7.3
8.7.3
8.4.3
8.4.4
8.2.3
8.4.2
Add a clause to the data base, indexed by head’s predicate.
Walk the data structure TREE, returning a list of variabless seen once, and a list of variables seen more than once.
Return a list of all variables that occur only once in tree.
8.5.2
The arguments of a relation
8.9.1
8.9.2
for Common Lisp
8.16.4
8.16.5
8.16.2
8.16.1
8.3.2
8.3.5
8.10.2: Find all solutions to GOAL, and for each solution, collect the value of EXP into the list RESULT.
Extend bindings to include any unbound variables in goal.
If there are any variables in exp (besides the parameters) then bind them to new vars.
Bind all variables in exp to themselves, and add that to bindings (except for variables already bound).
7.8.3: Try to prove goal by calling it.
7.8.9
8.16.6
8.8.1
Return all clauses whose head has given arity.
remove all clauses (for all predicates) from the data base.
remove the clauses for a single predicate.
8.11.7
8.11.8
Generate code for an argument to a goal in the body.
Compile the body of a clause.
Compile a call to a prolog predicate.
Transform away the head, and compile the resulting body.
Compile a Lisp IF form. No else-part allowed.
Compile all the clauses for a given symbol/arity into a single LISP function.
Return 2 values: code to test if x and y unify, and a new binding list.
X is a variable, and Y may be.
8.3.6
Ask user if we should continue looking for solutions.
8.5.4
8.11.2
8.11.3
Copy the expression, replacing variables with new ones. The part without variables can be returned as is.
Are the two arguments EQUAL with no unification, but with dereferencing?
Build something equivalent to EXP with variables dereferenced.
Expand out all pattern matching abbreviations in pat.
8.15.1: Negation by failure: If you can’t prove G, then (not G) true.
7.8.1
does predicate apply to any atom in the tree?
8.10.1: Find all solutions to GOAL, and for each solution, collect the value of TERM into the list BAG.
Find the first position that pat1 could possibly match input, starting at position start. If pat1 is non-constant, then just return start.
8.11.9
8.11.10
Get the ultimate binding of var according to bindings.
8.5.1
8.12.1
8.12.2
Is there a variable anywhere in the expression x?
8.3.3
8.6.1
Replace variables that are only used once with ?.
Return the list (?arg1 ?arg2 ... ?arg-arity)
Return the symbol: symbol/arity
Succeed if all the patterns match the input.
Test an arbitrary expression involving variables. The pattern looks like ((?if code) . rest).
Succeed and bind var if the input satisfies pred, where var-and-pred is the list (var pred).
Succeed if none of the patterns match the input. This will never bind any variables.
Succeed if any one of the patterns match the input.
Undo any bindings that need undoing.
If there are any, bind the trail before we start.
8.12.5
8.12.6
8.3.7
8.16.7
8.16.8
8.3.8
Does var occur anywhere inside x?
8.15.2
8.11.6
Define symbol as a macro standing for a pat-match pattern.
Compile a symbol; make a separate function for each arity.
Compile a list of Prolog symbols.
By default, the list is all symbols that need it.
Fetch the compiler macro for a Prolog predicate.
Is x a proper (non-dotted) list?
Return a list of possible solutions to goal.
Find a solution to the conjunction of goals.
8.12.3
8.12.4
8.3.4
The number of arguments to a relation. Example: (relation-arity ’(p a b c)) => 3
replace all variables in x with new ones.
8.15.3
Replace any ? within exp with a var of the form ?123.
Retract a clause from the data base
Retract a clause from the data base
8.9.3
Find the first rule in rules that matches input, and apply the action to that rule.
Run a 0-ary prolog procedure with a given continuation.
Match the segment pattern ((?* var) . pat) against input.
Match one or more elements of input.
Get the segment-match function for x, if it is a symbol that has one.
Match zero or one element of input.
Call the right function for this kind of segment pattern.
Is this a segment-matching pattern like ((?* var) . pat)?
Set var’s binding to value, after saving the variable in the trail. Always returns t.
8.11.4
8.11.5
8.11.14
8.10.3: Find all unique solutions to GOAL, and for each solution, collect the value of EXP into the list RESULT.
Print each variable with its binding.
Then ask the user if more solutions are desired.
Display the variables, and prompt the user to see
if we should continue. If not, return to the top level.
Get the single-match function for x, if it is a symbol that has one.
Call the right function for this kind of single pattern.
Is this a single-matching pattern?
E.g. (?is x predicate) (?and . patterns) (?or . patterns).
for Common Lisp
8.16.3
Substitute the value of variables in bindings into x, taking recursively bound variables into account.
7.8.10
Prove the list of goals by compiling and calling it.
7.8.2
Is EXP an unbound var?
Undo all bindings back to a given point in the trail.
Return something that unifies with both x and y (or fail).
See if x and y match with given bindings.
Destructively unify two expressions
Unify var with x, using (and maybe extending) bindings.
8.2.2
return a list of leaves of tree satisfying predicate, with duplicates removed.
8.3.1
Return a list of all the variables in EXP.
prolog-throw
)) ¶ball
.
Jump to: | !
(
<
=
>
?
@
\
A B C D E F G H I L M N O P Q R S T U V W |
---|
Jump to: | !
(
<
=
>
?
@
\
A B C D E F G H I L M N O P Q R S T U V W |
---|
Jump to: | *
B C F N S U V |
---|
Jump to: | *
B C F N S U V |
---|
Jump to: | A C D F P S U V |
---|
Jump to: | A C D F P S U V |
---|