The rs-dlx Reference Manual

This is the rs-dlx Reference Manual, version 1.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:37:34 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 rs-dlx

Knuth’s Algorithm X with dancing links.

Author

Ralph Schleicher <>

License

Modified BSD License

Version

1.1

Dependencies
  • alexandria (system).
  • iterate (system).
Source

rs-dlx.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 rs-dlx/rs-dlx.asd

Source

rs-dlx.asd.

Parent Component

rs-dlx (system).

ASDF Systems

rs-dlx.


3.1.2 rs-dlx/packages.lisp

Source

rs-dlx.asd.

Parent Component

rs-dlx (system).

Packages

de.ralph-schleicher.dlx.


3.1.3 rs-dlx/common.lisp

Dependency

packages.lisp (file).

Source

rs-dlx.asd.

Parent Component

rs-dlx (system).

Internals

3.1.4 rs-dlx/dlx.lisp

Dependency

common.lisp (file).

Source

rs-dlx.asd.

Parent Component

rs-dlx (system).

Public Interface
Internals

3.1.5 rs-dlx/api.lisp

Dependency

dlx.lisp (file).

Source

rs-dlx.asd.

Parent Component

rs-dlx (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 de.ralph-schleicher.dlx

Knuth’s Algorithm X using the dancing links technique.

The algorithm itself is executed by the ‘solve’ function. The remaining functions manage the incidence matrix, i.e. the sparse matrix data structure based on circular doubly linked lists as described in Knuth’s “Dancing Links” paper.

Donald E. Knuth: “Dancing Links”, ‹https://arxiv.org/abs/cs/0011047›.

Source

packages.lisp.

Nickname

rs-dlx

Use List
  • common-lisp.
  • iterate.
Public Interface
Internals

5 Definitions

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


5.1 Public Interface


5.1.1 Ordinary functions

Function: add-matrix-column (matrix elements &key name initial-element)

Add a column vector at the end of a matrix.

First argument MATRIX is a matrix object.
Second argument ELEMENTS specifies the matrix elements. Value has
to be a list with elements of the form ‘(INDEX . VALUE)’ or just ‘INDEX’ where INDEX and VALUE is the row index and value of a
matrix element. For a plain ‘INDEX’, a value of one is used.
The matrix elements have to be supplied in strictly monotonically increasing order of the row index.
Keyword argument NAME is the symbolic identifier of the new matrix column.

Value is the matrix object. If an error occurs, the structure of
the original matrix is retained.

See also ‘make-matrix’, ‘matrix-element’, and ‘add-matrix-row’.

Exceptional Situations:

* Signals an error of type ‘program-error’ if the matrix
elements are not specified in strictly monotonically
increasing order of the row indices or if a row index
is out of bounds.

Examples:

(array-from-matrix
(add-matrix-column (add-matrix-column (make-matrix 5 0) ’(1 2 4)) ’(0 3))) ⇒ #2A((0 1) (1 0) (1 0) (0 1) (1 0))

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: add-matrix-row (matrix elements &key name initial-element)

Add a row vector at the end of a matrix.

First argument MATRIX is a matrix object.
Second argument ELEMENTS specifies the matrix elements. Value has to be a list with elements of the form ‘(INDEX . VALUE)’ or just ‘INDEX’ where INDEX and VALUE is the column index and value of a matrix element. For a plain ‘INDEX’, a value of one is used. The matrix elements have to be supplied in strictly monotonically increasing order of the column index.
Keyword argument NAME is the symbolic identifier of the new matrix row.

Value is the matrix object. If an error occurs, the structure of the original matrix is retained.

See also ‘make-matrix’, ‘matrix-element’, and ‘add-matrix-column’.

Exceptional Situations:

* Signals an error of type ‘program-error’ if the matrix elements are not specified in strictly monotonically increasing order of the column indices or if a column
index is out of bounds.

Examples:

(array-from-matrix
(add-matrix-row (add-matrix-row (make-matrix 0 5) ’(1 2 4)) ’(0 3))) ⇒ #2A((0 1 1 0 1) (1 0 0 1 0))

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: array-from-matrix (matrix &key element-type)

Convert a matrix object into an array.

Argument MATRIX is a matrix object.
Keyword argument ELEMENT-TYPE specifies the type of the values intended to be stored in the array elements. Value is a type specifier. Default is the element type of the matrix object.

Value is an array with two dimensions.

See also ‘matrix-from-array’ and ‘make-matrix’.

Exceptional Situations:

* The consequences are undefined if ELEMENT-TYPE is not a valid type specifier.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: column-index (object)

Return the index of a matrix column.

Argument OBJECT can be a matrix element or a column header.

Value is the zero-based column index.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: column-name (object &optional index)

Read or update the symbolic identifier of a matrix column.

First argument OBJECT can be a matrix, a column header, or a matrix element.
Optional second argument INDEX is the column index. This argument is only required if OBJECT is a matrix.

Value is the symbolic identifier of the matrix column.

Exceptional Situations:

* Signals an error of type ‘program-error’ if INDEX is out
out bounds.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: (setf column-name) (object &optional index)
Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: (setf column-names) (matrix)

Update the symbolic identifiers of the matrix columns.

Argument MATRIX is a matrix object.

Value is a list of column names. Not more than the total number of matrix columns are updated. If the list is shorter, the names of the remaining matrix columns are set to ‘nil’.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: make-matrix (rows columns &key element-type null-element)

Create a new matrix object.

First argument ROWS is the number of matrix rows. Value has to be a non-negative integer.
Second argument COLUMNS is the number of matrix columns. Value has to be a non-negative integer.
Keyword argument ELEMENT-TYPE specifies the type of the values intended to be stored in the matrix elements. Value is a type specifier. Default is ‘bit’.
Keyword argument NULL-ELEMENT is the value of a null element. Value has to be either the number zero or ‘nil’. Default is the number zero if ELEMENT-TYPE specifies a numeric type. Otherwise, the default is ‘nil’.

Value is a matrix object.

A matrix object is a sparse matrix based on circular doubly linked lists as described in Knuth’s “Dancing Links” paper. The matrix elements are addressed by a zero-based row and column index. Any index has to be a valid array index. All matrix elements are set to the null element initially. You can read or update a matrix element with the ‘matrix-element’ function. A more efficient way to fill a matrix is to create an empty matrix with either zero rows or zero columns, then use the ‘add-matrix-row’ function or ‘add-matrix-column’ function respectively to define the non-null elements.

See also ‘matrix-rows’, ‘matrix-columns’, ‘matrix-element’, ‘matrix-elements’, ‘add-matrix-row’, ‘add-matrix-column’, ‘matrix-from-array’, and ‘array-from-matrix’.

Exceptional Situations:

* The consequences are undefined if ELEMENT-TYPE is not
a valid type specifier.

Examples:

;; Create a logical matrix with elements in {0, 1}. (array-from-matrix (make-matrix 3 4))
⇒ #2A((0 0 0 0) (0 0 0 0) (0 0 0 0))

;; Create a logical matrix of generalized Boolean values. (array-from-matrix (make-matrix 3 4 :element-type t))
⇒ #2A((NIL NIL NIL NIL) (NIL NIL NIL NIL) (NIL NIL NIL NIL))

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: map-matrix-column (function matrix index)

Apply a function to every non-null element in a matrix column.

First argument FUNCTION is the function to be applied. Second argument MATRIX is the matrix object.
Third argument INDEX is the column index.

The function is called with one argument, the matrix element. Candidates for the FUNCTION argument are, e.g. ‘row-index’ or ‘row-name’.

Value is a list containing the results returned by FUNCTION.

See also ‘map-matrix-row’.

Exceptional Situations:

* Signals an error of type ‘program-error’ if INDEX is out of bounds.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: map-matrix-row (function matrix index)

Apply a function to every non-null element in a matrix row.

First argument FUNCTION is the function to be applied. Second argument MATRIX is the matrix object.
Third argument INDEX is the row index.

The function is called with one argument, the matrix element. Candidates for the FUNCTION argument are, e.g. ‘column-index’ or ‘column-name’.

Value is a list containing the results returned by FUNCTION.

See also ‘map-matrix-column’.

Exceptional Situations:

* Signals an error of type ‘program-error’ if INDEX is out of bounds.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: matrix-columns (matrix)

Return the number of matrix columns.

Argument MATRIX is a matrix object.

Value is the number of matrix columns.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: matrix-element (matrix row-index column-index)

Read or update the value of a matrix element.

First argument MATRIX is a matrix object.
Second argument ROW-INDEX is the row index of the matrix element. Third argument COLUMN-INDEX is the column index of the matrix element.

Value is the value of the referenced matrix element.

Exceptional Situations:

* Signals an error of type ‘program-error’ if ROW-INDEX or COLUMN-INDEX is out of bounds.

* Signals an error of type ‘type-error’ if the new value is
not compatible with the matrix element type.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: (setf matrix-element) (matrix row-index column-index)
Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: (setf matrix-elements) (matrix &optional start-row start-column)

Update multiple elements of a matrix.

First argument MATRIX is a matrix object.
Optional second argument START-ROW is the row index of the first matrix element. Default is zero.
Optional third argument START-COLUMN is the column index of the first matrix element. Default is zero.

Value is a two-dimensional array whose elements will be assigned to the block starting at START-ROW and START-COLUMN.

Exceptional Situations:

* Signals an error of type ‘program-error’ if START-ROW or START-COLUMN is out of bounds or if the dimensions of the new value relative to START-ROW and START-COLUMN exceed the matrix dimensions.

* Signals an error of type ‘type-error’ if the array element type of the new value is not a subtype of the matrix element type.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: matrix-from-array (array &key element-type null-element)

Convert an array into a matrix object.

Argument ARRAY is an array with two dimensions.
Keyword argument ELEMENT-TYPE specifies the type of the values intended to be stored in the matrix elements. Value is a type specifier. Default is ‘bit’.
Keyword argument NULL-ELEMENT defines the value of a null element. Default is the number zero if ELEMENT-TYPE specifies a numeric type. Otherwise, the default is ‘nil’.

Value is a matrix object.

See also ‘array-from-matrix’ and ‘make-matrix’.

Exceptional Situations:

* The consequences are undefined if ELEMENT-TYPE is not
a valid type specifier.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: matrix-rows (matrix)

Return the number of matrix rows.

Argument MATRIX is a matrix object.

Value is the number of matrix rows.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: remove-matrix-column (matrix index)

Remove a matrix column.

First argument MATRIX is a matrix object.
Second argument INDEX is a column index.

Value is the matrix object. If an error occurs, the structure of the original matrix is retained.

See also ‘remove-matrix-column-by-name’ and ‘remove-matrix-columns’.

Exceptional Situations:

* Signals an error of type ‘program-error’ if INDEX is out of bounds.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: remove-matrix-column-by-name (matrix name &key test)

Remove a matrix column.

First argument MATRIX is a matrix object.
Second argument NAME is a column name. Only the first column name matching NAME will be removed.
Keyword argument TEST defines the function to compare two column names for equality. Default is ‘eql’.

Value is the matrix object. If an error occurs, the structure of the original matrix is retained.

See also ‘remove-matrix-column’ and ‘remove-matrix-columns-by-name’.

Exceptional Situations:

* Signals an error of type ‘program-error’ if no column named NAME exists.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: remove-matrix-columns (matrix indices)

Remove some matrix columns.

First argument MATRIX is a matrix object.
Second argument INDICES is a list of column indices. No error is signaled if a column index does not exist.

Value is the matrix object.

See also ‘remove-matrix-columns-by-name’ and ‘remove-matrix-column’.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: remove-matrix-columns-by-name (matrix names &key test)

Remove some matrix columns.

First argument MATRIX is a matrix object.
Second argument NAMES is a list of column names. No error is signaled if a column name does not exist.
Keyword argument TEST defines the function to compare two column names for equality. Default is ‘eql’.

Value is the matrix object.

See also ‘remove-matrix-columns’ and ‘remove-matrix-column-by-name’.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: remove-matrix-row (matrix index)

Remove a matrix row.

First argument MATRIX is a matrix object.
Second argument INDEX is a row index.

Value is the matrix object. If an error occurs, the structure of the original matrix is retained.

See also ‘remove-matrix-row-by-name’ and ‘remove-matrix-rows’.

Exceptional Situations:

* Signals an error of type ‘program-error’ if INDEX is out of bounds.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: remove-matrix-row-by-name (matrix name &key test)

Remove a matrix row.

First argument MATRIX is a matrix object.
Second argument NAME is a row name. Only the first row name matching NAME will be removed.
Keyword argument TEST defines the function to compare two row names for equality. Default is ‘eql’.

Value is the matrix object. If an error occurs, the structure of the original matrix is retained.

See also ‘remove-matrix-row’ and ‘remove-matrix-rows-by-name’.

Exceptional Situations:

* Signals an error of type ‘program-error’ if no row named NAME exists.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: remove-matrix-rows (matrix indices)

Remove some matrix rows.

First argument MATRIX is a matrix object.
Second argument INDICES is a list of row indices. No error is signaled if a row index does not exist.

Value is the matrix object.

See also ‘remove-matrix-rows-by-name’ and ‘remove-matrix-row’.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: remove-matrix-rows-by-name (matrix names &key test)

Remove some matrix rows.

First argument MATRIX is a matrix object.
Second argument NAMES is a list of row names. No error is signaled if a row name does not exist.
Keyword argument TEST defines the function to compare two row names for equality. Default is ‘eql’.

Value is the matrix object.

See also ‘remove-matrix-rows’ and ‘remove-matrix-row-by-name’.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: row-index (object)

Return the row index of a matrix element.

Argument OBJECT can be a matrix element or a row header.

Value is the zero-based row index.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: row-name (object &optional index)

Read or update the symbolic identifier of a matrix row.

First argument OBJECT can be a matrix, a row header, or a matrix element.
Optional second argument INDEX is the row index. This argument is only required if OBJECT is a matrix.

Value is the symbolic identifier of the matrix row.

Exceptional Situations:

* Signals an error of type ‘program-error’ if INDEX is out out bounds.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: (setf row-name) (object &optional index)
Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: (setf row-names) (matrix)

Update the symbolic identifiers of the matrix rows.

Argument MATRIX is a matrix object.

Value is a list of row names. Not more than the total number of matrix rows are updated. If the list is shorter, the names of the remaining matrix rows are set to ‘nil’.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: solve (matrix &key maximum-number-of-solutions if-does-not-exist raw search-tree)

Apply Knuth’s Algorithm X to an exact cover problem.

Argument MATRIX is the incidence matrix of the exact cover problem where the rows represent the set of choices (a.k.a. possibilities or candidates) and the columns represent the set of constraints. Value is a matrix object.
Keyword argument MAXIMUM-NUMBER-OF-SOLUTIONS limits the number of solutions to search for. Value has to be a positive integer. A value of ‘nil’ means that there is no limit, i.e. search for all solutions. Default is one.
Keyword argument IF-DOES-NOT-EXIST specifies the action to be taken if no solution can be found. A value of ‘:error’ means to signal an error. A value of ‘nil’ means to return ‘nil’ to indicate failure. Default is ‘:error’.
If keyword argument RAW is true, the row indices in a solution are in the order as they have been found. Otherwise, they are sorted in ascending order. Default is false.
If keyword argument SEARCH-TREE is true, build the complete search tree and return it as the secondary value.

Return value is the list of found solutions. Each solution is a list of row indices of the incidence matrix. Secondary value is the search tree.

See also ‘make-matrix’.

Exceptional Situations:

* Signals an error of type ‘arithmetic-error’ if no solution can be found and the argument IF-DOES-NOT-EXIST is ‘:error’.

Examples:

;; Knuth’s example from the “Dancing Links” paper.
(let ((a (matrix-from-array #2A((0 0 1 0 1 1 0)
(1 0 0 1 0 0 1)
(0 1 1 0 0 1 0)
(1 0 0 1 0 0 0)
(0 1 0 0 0 0 1)
(0 0 0 1 1 0 1)))))
(setf (column-names a) ’(A B C D E F G))
(let ((s (first (solve a))))
(format t "Found a solution containing~%")
(dolist (i s)
(format t "~:R row with columns ~S~%"
(1+ i) (map-matrix-row #’column-name a i))) s))
⇒ (0 3 4)
;; And the terminal output is:
Found a solution containing
first row with columns (C E F)
fourth row with columns (A D)
fifth row with columns (B G)

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.


5.1.2 Standalone methods

Method: print-object ((header header) stream)

Print a ‘header’ object.

Source

dlx.lisp.

Method: print-object ((node node) stream)

Print a ‘node’ object.

Source

dlx.lisp.

Method: print-object ((element element) stream)

Print an ‘element’ object.

Source

dlx.lisp.

Method: print-object ((root root) stream)

Print a ‘root’ object.

Source

dlx.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *search-tree*

The complete search tree.

Value is an alist with cons cells of the form ‘(ITEM . ALIST)’ where ITEM is an element of the search path and ALIST is a subsequent search tree. If ALIST is ‘nil’, the cell is a leaf node.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Special Variable: *search-tree-p*

Whether or not to build the search tree.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Special Variable: *solution*

The current solution, i.e. search path.

Value is an adjustable vector with fill pointer. This is slightly slower than a simple list but it doesn’t cons.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Special Variable: *solution-count*

The number of found solutions.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Special Variable: *solution-count-limit*

The maximum number of solutions to search for.

A value of ‘nil’ means that there is no limit, i.e. search for all solutions. Default is to search for a single solution.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Special Variable: *solutions*

The set of found solutions.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.


5.2.2 Macros

Macro: defconst (name value &optional doc)

Define a constant variable.

This is like ‘defconstant’ except that the initially set value is reused when the ‘defconst’ form is evaluated again.

Package

de.ralph-schleicher.dlx.

Source

common.lisp.

Macro: defsubst (name arg-list &body body)

Define an inline function.

This is like ‘defun’ except that the function is globally marked for inline expansion by the compiler.

Package

de.ralph-schleicher.dlx.

Source

common.lisp.

Macro: with-tracing (&body body)

Mark analysis code.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.


5.2.3 Ordinary functions

Function: %initialize-node (node)

Link a ‘node’ object to itself.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: %make-element (row column value)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: %make-header (index name)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: %make-node ()
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: %make-root (rows columns element-type null-element)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: %remove-matrix-column (matrix header)

Remove a matrix column.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: %remove-matrix-columns (matrix items key test)

Remove some matrix columns.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: %remove-matrix-row (matrix header)

Remove a matrix row.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: %remove-matrix-rows (matrix items key test)

Remove some matrix rows.

Package

de.ralph-schleicher.dlx.

Source

api.lisp.

Function: add-search-path (path)

Add a search path to the ‘*search-tree*’ special variable.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: choose-column (h)

Choose a column header from matrix H.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: column (instance)
Writer: (setf column) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

column.

Function: column-header (root index)

Find a column header by it’s index.
Signal a ‘program-error’ if the column does not exist.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: column-index-type (root)

Return the type specifier for a valid column index.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: column-insert-node (node)

Insert node NODE in it’s column.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: column-insert-node-before (node other)

Insert node NODE in the column before node OTHER.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: column-remove-node (node)

Remove node NODE from it’s column.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: columns (instance)
Writer: (setf columns) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

columns.

Function: copy-solution ()

Create a copy of the current search path as a list.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: cover-column (c)

Cover column C.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: down (instance)
Writer: (setf down) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

down.

Reader: element-type (instance)
Writer: (setf element-type) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

element-type.

Function: element-type-p (object root)

Return true if OBJECT is a valid element.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: header-index (header)

Return the header index of HEADER.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: header-name (header)

Return the header name of HEADER.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: index (instance)
Writer: (setf index) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

index.

Reader: left (instance)
Writer: (setf left) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

left.

Function: make-element (row column value)

Create a new ‘element’ object.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: make-header (index &optional name)

Create a new ‘header’ object.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: make-node ()

Create a new ‘node’ object.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: make-root (rows columns element-type null-element)

Create a new ‘root’ object.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: make-solution ()

Create a new search path object.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: merge-search-path (path tree)

Merge a search path into a search tree.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: name (instance)
Writer: (setf name) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

name.

Function: non-empty-solution-p ()

Return true if the current search path is not empty.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: not-null-element (root)

Return the complement of the null element.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: null-element (instance)
Writer: (setf null-element) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

null-element.

Function: null-element-p (object root)

Return true if OBJECT is a null element.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: pop-solution ()

Remove the most recently added item from the current search path.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: push-solution (object)

Add an item to the current search path.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: remove-column (header)

Remove the matrix column designated by HEADER. Update the size of affected rows but not the root object or any column header.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: remove-row (header)

Remove the matrix row designated by HEADER.
Update the size of affected columns but not the root object or any row header.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: right (instance)
Writer: (setf right) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

right.

Reader: row (instance)
Writer: (setf row) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

row.

Function: row-header (root index)

Find a row header by it’s index.
Signal a ‘program-error’ if the row does not exist.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: row-index-type (root)

Return the type specifier for a valid row index.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: row-insert-node (node)

Insert node NODE in it’s row.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: row-insert-node-before (node other)

Insert node NODE in the row before node OTHER.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: row-remove-node (node)

Remove node NODE from it’s row.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: rows (instance)
Writer: (setf rows) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

rows.

Knuth’s Algorithm X.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: size (instance)
Writer: (setf size) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

size.

Reader: test (instance)
Writer: (setf test) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

test.

Function: tree-from-path (path)

Convert a search path into a search tree.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Function: uncover-column (c)

Uncover column C.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Reader: up (instance)
Writer: (setf up) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

up.

Reader: value (instance)
Writer: (setf value) (instance)
Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Target Slot

value.


5.2.4 Structures

Structure: element

An element (data object) of a dancing links matrix.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Direct superclasses

node.

Direct methods

print-object.

Direct slots
Slot: row
Type

(or null de.ralph-schleicher.dlx::header)

Readers

row.

Writers

(setf row).

Slot: column
Type

(or null de.ralph-schleicher.dlx::header)

Readers

column.

Writers

(setf column).

Slot: value
Initform

t

Readers

value.

Writers

(setf value).

Structure: header

A header node of a dancing links matrix.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Direct superclasses

node.

Direct methods

print-object.

Direct slots
Slot: index
Type

fixnum

Initform

0

Readers

index.

Writers

(setf index).

Slot: name
Readers

name.

Writers

(setf name).

Slot: size
Type

fixnum

Initform

0

Readers

size.

Writers

(setf size).

Structure: node

Base class for all nodes of a dancing links matrix.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Direct superclasses

structure-object.

Direct subclasses
Direct methods

print-object.

Direct slots
Slot: right
Type

(or null de.ralph-schleicher.dlx::node)

Readers

right.

Writers

(setf right).

Slot: left
Type

(or null de.ralph-schleicher.dlx::node)

Readers

left.

Writers

(setf left).

Slot: down
Type

(or null de.ralph-schleicher.dlx::node)

Readers

down.

Writers

(setf down).

Slot: up
Type

(or null de.ralph-schleicher.dlx::node)

Readers

up.

Writers

(setf up).

Structure: root

The root node of a dancing links matrix.

Package

de.ralph-schleicher.dlx.

Source

dlx.lisp.

Direct superclasses

node.

Direct methods

print-object.

Direct slots
Slot: rows
Type

fixnum

Initform

0

Readers

rows.

Writers

(setf rows).

Slot: columns
Type

fixnum

Initform

0

Readers

columns.

Writers

(setf columns).

Slot: element-type
Initform

t

Readers

element-type.

Writers

(setf element-type).

Slot: null-element
Readers

null-element.

Writers

(setf null-element).

Slot: test
Type

(function (t t) t)

Initform

(function eql)

Readers

test.

Writers

(setf test).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
A   C   D   E   F   H   I   L   M   N   P   R   S   T   U   V   W  
Index Entry  Section

%
%initialize-node: Private ordinary functions
%make-element: Private ordinary functions
%make-header: Private ordinary functions
%make-node: Private ordinary functions
%make-root: Private ordinary functions
%remove-matrix-column: Private ordinary functions
%remove-matrix-columns: Private ordinary functions
%remove-matrix-row: Private ordinary functions
%remove-matrix-rows: Private ordinary functions

(
(setf column): Private ordinary functions
(setf column-name): Public ordinary functions
(setf column-names): Public ordinary functions
(setf columns): Private ordinary functions
(setf down): Private ordinary functions
(setf element-type): Private ordinary functions
(setf index): Private ordinary functions
(setf left): Private ordinary functions
(setf matrix-element): Public ordinary functions
(setf matrix-elements): Public ordinary functions
(setf name): Private ordinary functions
(setf null-element): Private ordinary functions
(setf right): Private ordinary functions
(setf row): Private ordinary functions
(setf row-name): Public ordinary functions
(setf row-names): Public ordinary functions
(setf rows): Private ordinary functions
(setf size): Private ordinary functions
(setf test): Private ordinary functions
(setf up): Private ordinary functions
(setf value): Private ordinary functions

A
add-matrix-column: Public ordinary functions
add-matrix-row: Public ordinary functions
add-search-path: Private ordinary functions
array-from-matrix: Public ordinary functions

C
choose-column: Private ordinary functions
column: Private ordinary functions
column-header: Private ordinary functions
column-index: Public ordinary functions
column-index-type: Private ordinary functions
column-insert-node: Private ordinary functions
column-insert-node-before: Private ordinary functions
column-name: Public ordinary functions
column-remove-node: Private ordinary functions
columns: Private ordinary functions
copy-solution: Private ordinary functions
cover-column: Private ordinary functions

D
defconst: Private macros
defsubst: Private macros
down: Private ordinary functions

E
element-type: Private ordinary functions
element-type-p: Private ordinary functions

F
Function, %initialize-node: Private ordinary functions
Function, %make-element: Private ordinary functions
Function, %make-header: Private ordinary functions
Function, %make-node: Private ordinary functions
Function, %make-root: Private ordinary functions
Function, %remove-matrix-column: Private ordinary functions
Function, %remove-matrix-columns: Private ordinary functions
Function, %remove-matrix-row: Private ordinary functions
Function, %remove-matrix-rows: Private ordinary functions
Function, (setf column): Private ordinary functions
Function, (setf column-name): Public ordinary functions
Function, (setf column-names): Public ordinary functions
Function, (setf columns): Private ordinary functions
Function, (setf down): Private ordinary functions
Function, (setf element-type): Private ordinary functions
Function, (setf index): Private ordinary functions
Function, (setf left): Private ordinary functions
Function, (setf matrix-element): Public ordinary functions
Function, (setf matrix-elements): Public ordinary functions
Function, (setf name): Private ordinary functions
Function, (setf null-element): Private ordinary functions
Function, (setf right): Private ordinary functions
Function, (setf row): Private ordinary functions
Function, (setf row-name): Public ordinary functions
Function, (setf row-names): Public ordinary functions
Function, (setf rows): Private ordinary functions
Function, (setf size): Private ordinary functions
Function, (setf test): Private ordinary functions
Function, (setf up): Private ordinary functions
Function, (setf value): Private ordinary functions
Function, add-matrix-column: Public ordinary functions
Function, add-matrix-row: Public ordinary functions
Function, add-search-path: Private ordinary functions
Function, array-from-matrix: Public ordinary functions
Function, choose-column: Private ordinary functions
Function, column: Private ordinary functions
Function, column-header: Private ordinary functions
Function, column-index: Public ordinary functions
Function, column-index-type: Private ordinary functions
Function, column-insert-node: Private ordinary functions
Function, column-insert-node-before: Private ordinary functions
Function, column-name: Public ordinary functions
Function, column-remove-node: Private ordinary functions
Function, columns: Private ordinary functions
Function, copy-solution: Private ordinary functions
Function, cover-column: Private ordinary functions
Function, down: Private ordinary functions
Function, element-type: Private ordinary functions
Function, element-type-p: Private ordinary functions
Function, header-index: Private ordinary functions
Function, header-name: Private ordinary functions
Function, index: Private ordinary functions
Function, left: Private ordinary functions
Function, make-element: Private ordinary functions
Function, make-header: Private ordinary functions
Function, make-matrix: Public ordinary functions
Function, make-node: Private ordinary functions
Function, make-root: Private ordinary functions
Function, make-solution: Private ordinary functions
Function, map-matrix-column: Public ordinary functions
Function, map-matrix-row: Public ordinary functions
Function, matrix-columns: Public ordinary functions
Function, matrix-element: Public ordinary functions
Function, matrix-from-array: Public ordinary functions
Function, matrix-rows: Public ordinary functions
Function, merge-search-path: Private ordinary functions
Function, name: Private ordinary functions
Function, non-empty-solution-p: Private ordinary functions
Function, not-null-element: Private ordinary functions
Function, null-element: Private ordinary functions
Function, null-element-p: Private ordinary functions
Function, pop-solution: Private ordinary functions
Function, push-solution: Private ordinary functions
Function, remove-column: Private ordinary functions
Function, remove-matrix-column: Public ordinary functions
Function, remove-matrix-column-by-name: Public ordinary functions
Function, remove-matrix-columns: Public ordinary functions
Function, remove-matrix-columns-by-name: Public ordinary functions
Function, remove-matrix-row: Public ordinary functions
Function, remove-matrix-row-by-name: Public ordinary functions
Function, remove-matrix-rows: Public ordinary functions
Function, remove-matrix-rows-by-name: Public ordinary functions
Function, remove-row: Private ordinary functions
Function, right: Private ordinary functions
Function, row: Private ordinary functions
Function, row-header: Private ordinary functions
Function, row-index: Public ordinary functions
Function, row-index-type: Private ordinary functions
Function, row-insert-node: Private ordinary functions
Function, row-insert-node-before: Private ordinary functions
Function, row-name: Public ordinary functions
Function, row-remove-node: Private ordinary functions
Function, rows: Private ordinary functions
Function, search: Private ordinary functions
Function, size: Private ordinary functions
Function, solve: Public ordinary functions
Function, test: Private ordinary functions
Function, tree-from-path: Private ordinary functions
Function, uncover-column: Private ordinary functions
Function, up: Private ordinary functions
Function, value: Private ordinary functions

H
header-index: Private ordinary functions
header-name: Private ordinary functions

I
index: Private ordinary functions

L
left: Private ordinary functions

M
Macro, defconst: Private macros
Macro, defsubst: Private macros
Macro, with-tracing: Private macros
make-element: Private ordinary functions
make-header: Private ordinary functions
make-matrix: Public ordinary functions
make-node: Private ordinary functions
make-root: Private ordinary functions
make-solution: Private ordinary functions
map-matrix-column: Public ordinary functions
map-matrix-row: Public ordinary functions
matrix-columns: Public ordinary functions
matrix-element: Public ordinary functions
matrix-from-array: Public ordinary functions
matrix-rows: Public ordinary functions
merge-search-path: Private ordinary functions
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods

N
name: Private ordinary functions
non-empty-solution-p: Private ordinary functions
not-null-element: Private ordinary functions
null-element: Private ordinary functions
null-element-p: Private ordinary functions

P
pop-solution: Private ordinary functions
print-object: Public standalone methods
print-object: Public standalone methods
print-object: Public standalone methods
print-object: Public standalone methods
push-solution: Private ordinary functions

R
remove-column: Private ordinary functions
remove-matrix-column: Public ordinary functions
remove-matrix-column-by-name: Public ordinary functions
remove-matrix-columns: Public ordinary functions
remove-matrix-columns-by-name: Public ordinary functions
remove-matrix-row: Public ordinary functions
remove-matrix-row-by-name: Public ordinary functions
remove-matrix-rows: Public ordinary functions
remove-matrix-rows-by-name: Public ordinary functions
remove-row: Private ordinary functions
right: Private ordinary functions
row: Private ordinary functions
row-header: Private ordinary functions
row-index: Public ordinary functions
row-index-type: Private ordinary functions
row-insert-node: Private ordinary functions
row-insert-node-before: Private ordinary functions
row-name: Public ordinary functions
row-remove-node: Private ordinary functions
rows: Private ordinary functions

S
search: Private ordinary functions
size: Private ordinary functions
solve: Public ordinary functions

T
test: Private ordinary functions
tree-from-path: Private ordinary functions

U
uncover-column: Private ordinary functions
up: Private ordinary functions

V
value: Private ordinary functions

W
with-tracing: Private macros


A.3 Variables

Jump to:   *  
C   D   E   I   L   N   R   S   T   U   V  
Index Entry  Section

*
*search-tree*: Private special variables
*search-tree-p*: Private special variables
*solution*: Private special variables
*solution-count*: Private special variables
*solution-count-limit*: Private special variables
*solutions*: Private special variables

C
column: Private structures
columns: Private structures

D
down: Private structures

E
element-type: Private structures

I
index: Private structures

L
left: Private structures

N
name: Private structures
null-element: Private structures

R
right: Private structures
row: Private structures
rows: Private structures

S
size: Private structures
Slot, column: Private structures
Slot, columns: Private structures
Slot, down: Private structures
Slot, element-type: Private structures
Slot, index: Private structures
Slot, left: Private structures
Slot, name: Private structures
Slot, null-element: Private structures
Slot, right: Private structures
Slot, row: Private structures
Slot, rows: Private structures
Slot, size: Private structures
Slot, test: Private structures
Slot, up: Private structures
Slot, value: Private structures
Special Variable, *search-tree*: Private special variables
Special Variable, *search-tree-p*: Private special variables
Special Variable, *solution*: Private special variables
Special Variable, *solution-count*: Private special variables
Special Variable, *solution-count-limit*: Private special variables
Special Variable, *solutions*: Private special variables

T
test: Private structures

U
up: Private structures

V
value: Private structures