The cl-prolog2 Reference Manual

This is the cl-prolog2 Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:17:19 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-prolog2

Common Interface to the ISO prolog implementations from Common Lisp

Author

Masataro Asai

Contact

License

MIT

Version

0.1

Dependencies
  • trivia (system).
  • alexandria (system).
  • trivia.quasiquote (system).
  • external-program (system).
  • trivial-garbage (system).
Source

cl-prolog2.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-prolog2/cl-prolog2.asd

Source

cl-prolog2.asd.

Parent Component

cl-prolog2 (system).

ASDF Systems

cl-prolog2.


3.1.2 cl-prolog2/package.lisp

Source

cl-prolog2.asd.

Parent Component

cl-prolog2 (system).

Packages

3.1.3 cl-prolog2/compiler-macro.lisp

Dependency

package.lisp (file).

Source

cl-prolog2.asd.

Parent Component

cl-prolog2 (system).

Internals

3.1.4 cl-prolog2/printers.lisp

Dependency

compiler-macro.lisp (file).

Source

cl-prolog2.asd.

Parent Component

cl-prolog2 (system).

Internals

3.1.5 cl-prolog2/interpreter.lisp

Dependency

printers.lisp (file).

Source

cl-prolog2.asd.

Parent Component

cl-prolog2 (system).

Public Interface

3.1.6 cl-prolog2/util.lisp

Dependency

interpreter.lisp (file).

Source

cl-prolog2.asd.

Parent Component

cl-prolog2 (system).

Public Interface

4 Packages

Packages are listed by definition order.


4.1 cl-prolog2.impl

Source

package.lisp.

Use List
  • alexandria.
  • cl-prolog2.
  • common-lisp.
  • trivia.level2.
Public Interface
Internals

4.2 cl-prolog2

Source

package.lisp.

Used By List

cl-prolog2.impl.

Public Interface

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *debug-prolog*

Flag (0-3) for debugging the input to the prolog interpreter. 0 : disabled.
>=1: print the command line
>=2: print the prolog output
3 : most verbose. print misc messages.

Package

cl-prolog2.

Source

interpreter.lisp.


5.1.2 Macros

Macro: with-temp ((var &key directory template tmpdir debug) &body body)

Create a temporary file, then remove the file by unwind-protect.
Most arguments are analogous to mktemp.
When DIRECTORY is non-nil, creates a directory instead.
DEBUG is a form.
When evaluated to non-nil, it does not remove the directory so that you can investigate what happened inside the directory. It may be evaluated multiple times.

Package

cl-prolog2.impl.

Source

interpreter.lisp.


5.1.3 Ordinary functions

Function: print-rule (stream rule)
Package

cl-prolog2.impl.

Source

interpreter.lisp.

Function: print-sexp (&key swi)

This function returns a cl-prolog2 program for a prolog rule print-sexp/1,
which prints a prolog term in a SEXP form.

print-sexp prints atoms/numbers as atoms/numbers, a term as a list, and a list as a list.

To be used with SWI, SWI should be non-nil due to the implementation-specific matter. (It uses compound_name_arguments/2 instead of =../2 for printing a term.)

usage:

(run-prolog ‘((:- main
(print-sexp (parent-of luke anakin))
halt)
(:- (initialization main))
,@(print-sexp :swi t))
:swi :output :string)

;; -> "(parent-of luke anakin)", NIL, 0

Package

cl-prolog2.

Source

util.lisp.

Function: run-command-with-debug-print (command &rest args)
Package

cl-prolog2.impl.

Source

interpreter.lisp.

Function: sort-clauses (rules)

Destructively sort the rules by dictionary ordering.
Useful for avoiding noncontiguous-clauses errors (rules for the same clauses are not written adjacently). Facts (rules without conditions) are given precedence to the standard rules.
Sorting is stable.
However, since it alters the ordering of the rules and Prolog checks the rules from top-to-bottom,
it may corrupt the program especially when cut operator (!) is involved.

Package

cl-prolog2.

Source

util.lisp.


5.1.4 Generic functions

Generic Function: run-prolog (rules prolog-designator &key debug args input output error &allow-other-keys)
Package

cl-prolog2.

Source

interpreter.lisp.


5.2 Internals


5.2.1 Compiler macros

Compiler Macro: %print-rule (stream obj colon at)
Package

cl-prolog2.impl.

Source

compiler-macro.lisp.

Compiler Macro: print-commas (stream obj colon at)
Package

cl-prolog2.impl.

Source

compiler-macro.lisp.

Compiler Macro: print-semicolons (stream obj colon at)
Package

cl-prolog2.impl.

Source

compiler-macro.lisp.

Compiler Macro: print-term (stream obj colon at)
Package

cl-prolog2.impl.

Source

compiler-macro.lisp.


5.2.2 Ordinary functions

Function: %print-rule (stream list colon at)
Package

cl-prolog2.impl.

Source

printers.lisp.

Function: constant-fold-printer (env whole)
Package

cl-prolog2.impl.

Source

compiler-macro.lisp.

Function: print-commas (stream list colon at)
Package

cl-prolog2.impl.

Source

printers.lisp.

Function: print-semicolons (stream list colon at)
Package

cl-prolog2.impl.

Source

printers.lisp.

Function: print-term (stream term colon at)
Package

cl-prolog2.impl.

Source

printers.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %  
C   F   G   M   P   R   S   W  
Index Entry  Section

%
%print-rule: Private compiler macros
%print-rule: Private ordinary functions

C
Compiler Macro, %print-rule: Private compiler macros
Compiler Macro, print-commas: Private compiler macros
Compiler Macro, print-semicolons: Private compiler macros
Compiler Macro, print-term: Private compiler macros
constant-fold-printer: Private ordinary functions

F
Function, %print-rule: Private ordinary functions
Function, constant-fold-printer: Private ordinary functions
Function, print-commas: Private ordinary functions
Function, print-rule: Public ordinary functions
Function, print-semicolons: Private ordinary functions
Function, print-sexp: Public ordinary functions
Function, print-term: Private ordinary functions
Function, run-command-with-debug-print: Public ordinary functions
Function, sort-clauses: Public ordinary functions

G
Generic Function, run-prolog: Public generic functions

M
Macro, with-temp: Public macros

P
print-commas: Private compiler macros
print-commas: Private ordinary functions
print-rule: Public ordinary functions
print-semicolons: Private compiler macros
print-semicolons: Private ordinary functions
print-sexp: Public ordinary functions
print-term: Private compiler macros
print-term: Private ordinary functions

R
run-command-with-debug-print: Public ordinary functions
run-prolog: Public generic functions

S
sort-clauses: Public ordinary functions

W
with-temp: Public macros


A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*debug-prolog*: Public special variables

S
Special Variable, *debug-prolog*: Public special variables