The dlist Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The dlist Reference Manual

This is the dlist Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:27:05 2022 GMT+0.

Table of Contents


1 Introduction

dlist - A Common Lisp library that implements doubly-linked lists

dlist is a Common Lisp library that implements the doubly-linked list data structure. dlist provides many operations on doubly-linked lists, or dlists, which are documented in the file documentation.html , which is available with the source. If your lisp implementation supports user-extensible sequences (which only SBCL and ABCL do currently), you will be able to use the standard Common Lisp sequence functions (map, reduce, etc.) with dlists. dlist does not have any dependencies other than a common lisp implementation.

Obtaining and installing dlist

dlist is available from http://github.com/krzysz00/dlist and can be installed via Quicklisp (not yet). To use dlist, simply load the ASDF system. Use:

(asdf:oos 'asdf:test-op :dlist)

to run the test suite.

dlist is licensed under the 3-Clause BSD Licence, see the file COPYING for details.

Contact Information

You can reach the author (Krzysztof Drewniak) at krzysdrewniak@gmail.com. If you find any bugs, please report them at dlist's GitHub issue tracker.


2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 dlist

An implementation of the doubly-linked list in Common Lisp.

Author

Krzyszxtof Drewniak <krzysdrewniak@gmail.com>

License

3-Clause BSD

Source

dlist.asd.

Child Components

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 dlist/dlist.asd

Source

dlist.asd.

Parent Component

dlist (system).

ASDF Systems

dlist.

Packages

dlist-system.


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.2 dlist/package.lisp

Source

dlist.asd.

Parent Component

dlist (system).

Packages

dlist.


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.3 dlist/dcons.lisp

Dependency

package.lisp (file).

Source

dlist.asd.

Parent Component

dlist (system).

Public Interface
Internals

3.1.4 dlist/dlist.lisp

Dependency

dcons.lisp (file).

Source

dlist.asd.

Parent Component

dlist (system).

Public Interface
Internals

Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.5 dlist/modification.lisp

Dependency

dlist.lisp (file).

Source

dlist.asd.

Parent Component

dlist (system).

Public Interface

3.1.6 dlist/mapping.lisp

Dependency

modification.lisp (file).

Source

dlist.asd.

Parent Component

dlist (system).

Public Interface

3.1.7 dlist/more-ops.lisp

Dependency

mapping.lisp (file).

Source

dlist.asd.

Parent Component

dlist (system).

Public Interface

Previous: , Up: Lisp   [Contents][Index]

3.1.8 dlist/generic-sequences.lisp

Dependency

more-ops.lisp (file).

Source

dlist.asd.

Parent Component

dlist (system).

Public Interface

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 dlist

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

Previous: , Up: Packages   [Contents][Index]

4.2 dlist-system

Source

dlist.asd.

Use List
  • asdf/interface.
  • common-lisp.

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: dlist-pop (dlist &key from-end)

Pops an element from dlist and returns it. If ‘from-end’ is non-‘nil’, the element will be popped from the end of the dlist. Otherwise, it will be popped from the begining.

Package

dlist.

Source

modification.lisp.

Macro: dlist-push (obj dlist &key at-end)

Pushes ‘obj’ onto ‘dlist’. If ‘at-end’ is not-nil, the element is added to the end of dlist, otherwise it is added to the begining.

Package

dlist.

Source

modification.lisp.

Macro: dodcons ((var dlist &optional result-form from-end) &body body)

Loops over the dconses in ‘dlist’, binding ‘var’ to each in turn. If ‘from-end’ is non-nil, the loop proceeds from the last element of ther list to the first. This is basically ‘dolist’ for dlists.

Package

dlist.

Source

mapping.lisp.

Macro: dodlist ((var dlist &optional result-form from-end) &body body)

Loops over the elements in ‘dlist’, binding each to ‘var’ in turn, then executing ‘body’. If ‘from-end’ is non-nil, the loop proceeds from the end of the list to the begining.

Package

dlist.

Source

mapping.lisp.


5.1.2 Ordinary functions

Function: copy-dlist (dlist &key deep-copy)

Copies ‘dlist’, returning a new dlist with the same elements as ‘dlist’. If ‘deep-copy’ is true, ‘copy-dlist’ deep-copies dlists and sequences.

Package

dlist.

Source

more-ops.lisp.

Function: data (dcons)

Accesses the ‘data’ slot of a dcons. The ‘data’ of nil is nil.

Package

dlist.

Source

dcons.lisp.

Function: (setf data) (place)

Sets the ‘data’ slot of ‘place’ (which must be a ‘dcons’) to ‘val’

Package

dlist.

Source

dcons.lisp.

Function: dcons (prev data next)

Constructs a ‘dcons’ with the given ‘prev’, ‘data’, and ‘next’

Package

dlist.

Source

dcons.lisp.

Function: dconsp (object)

Returns T if ‘object’ is a dcons

Package

dlist.

Source

dcons.lisp.

Function: dlist (&rest elements)

Returns a doubly-linked list (dlist) with the elements in ‘elements’

Package

dlist.

Source

dlist.lisp.

Function: dlist->list (dlist)

Converts a dlist to a list

Package

dlist.

Source

dlist.lisp.

Function: dlist-append (&rest dlists)

Appends ‘dlists’ non-derstructively by calling ‘dlist-nconc’ with shallow copies of each dlist.

Package

dlist.

Source

more-ops.lisp.

Function: dlist-first (dlist)

Gets the first ‘dcons’ in a ‘dlist’

Package

dlist.

Source

dlist.lisp.

Function: (setf dlist-first) (place)
Package

dlist.

Source

dlist.lisp.

Function: dlist-last (dlist)

Gets the last ‘dcons’ in a ‘dlist’

Package

dlist.

Source

dlist.lisp.

Function: (setf dlist-last) (place)
Package

dlist.

Source

dlist.lisp.

Function: dlist-length (dlist)

Returns the length of ‘dlist’

Package

dlist.

Source

more-ops.lisp.

Function: dlist-nconc (&rest dlists)

Appends ‘dlists’. This works like ‘nconc’ for singly-linked lists, except it is destructive and the resuld will share structure with the input dlists. This function should have running time proportional to the number of lists being appended.

Package

dlist.

Source

modification.lisp.

Function: dlist-nth (n dlist &key from-end)

Returns the nth element of ‘dlist’, as the primary value. If n is >= the length of the list, NIL will be returned. The secondary value will be T if the value was actually found in the list, and NIL otherwise. If ‘from-end’ is true, ‘dlist-nth’ returns the @code{n}th element from the end, subject to the rules above.

Package

dlist.

Source

dlist.lisp.

Function: (setf dlist-nth) (n dlist &key from-end)

Sets the data of the nth dcons in ‘dlist’ to ‘val’. If ‘from-end’ is true, sets the @code{n}th element from the end.

Package

dlist.

Source

dlist.lisp.

Function: dlist-reverse (dlist)

Reverses dlist non-destructively.

Package

dlist.

Source

more-ops.lisp.

Function: dlist= (dlist &rest more-dlists)

Tests dlists for equality by element, recursively descending into sub-dlists.

Package

dlist.

Source

dlist.lisp.

Function: dlistp (object)

Tests if ‘object’ is a dlist.

Package

dlist.

Source

dlist.lisp.

Function: make-dlist (size &key initial-element)

Creates a dlist that contains ‘initial-element’ ‘size’ times.

Package

dlist.

Source

more-ops.lisp.

Function: mapdcon (function dlist &rest more-dlists-and-from-end)

Maps ‘function’ over ‘dlist’ the dconses in ‘dlist’, then returns ‘dlist’

Package

dlist.

Source

mapping.lisp.

Function: mapdcons (function dlist &rest more-dlists-and-from-end)

Maps over the dconses in ‘dlist’ and ‘more-dlists’. If ‘more-dlists’ contains the keyword :from-end, the value after it in the argumnt list will be taken as the value of :from-end, and both will be removed from ‘more-dlists’. The order of elements in the result is the same as the oder in which the elements are returned from the function.

Package

dlist.

Source

mapping.lisp.

Function: mapdlist (function dlist &rest more-dlists-and-from-end)

Behaves like ‘mapdcons’, except the function will be passed the ‘data’ of each dcons.

Package

dlist.

Source

mapping.lisp.

Function: next (dcons)

Accesses the ‘next’ slot of a dcons. The ‘next’ of nil is nil.

Package

dlist.

Source

dcons.lisp.

Function: (setf next) (place)

Sets the ‘next’ slot of ‘place’ (which must be a ‘dcons’) to ‘val’

Package

dlist.

Source

dcons.lisp.

Function: nthdcons (n dlist &key from-end)

Returns the @code{n}th dcons in ‘dlist’ (zero-based). If n is >= the length of the list, returns NIL. If ‘from-end’ is true, returns the @code{n}th dcons from the end.

Package

dlist.

Source

dlist.lisp.

Function: prev (dcons)

Accesses the ‘prev’ slot of a dcons. The ‘prev’ of nil is nil.

Package

dlist.

Source

dcons.lisp.

Function: (setf prev) (place)

Sets the ‘prev’ slot of ‘place’ (which must be a ‘dcons’) to ‘val’

Package

dlist.

Source

dcons.lisp.


5.1.3 Standalone methods

Method: adjust-sequence ((seq dlist) length &key initial-element initial-contents)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: describe-object ((dlist dlist) stream)
Source

dlist.lisp.

Method: (setf elt) ((seq dlist) i)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: elt ((x dlist) n)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: (setf iterator-element) ((seq dlist) iter)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: iterator-element ((seq dlist) iter)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: iterator-endp ((seq dlist) iter lim from-end)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: iterator-index ((seq dlist) iter)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: iterator-step ((seq dlist) iter from-end)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: length ((x dlist))
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: make-sequence-iterator ((seq dlist) &key from-end start end)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: make-sequence-like ((seq dlist) length &key initial-element initial-contents)
Package

sb-sequence.

Source

generic-sequences.lisp.

Method: print-object ((object dlist) stream)
Source

dlist.lisp.

Method: reverse ((seq dlist))
Package

sb-sequence.

Source

generic-sequences.lisp.


5.1.4 Structures

Structure: dcons

A three-member cons cell for doubly-linked lists, which has ‘prev’, ‘data’ and ‘next’ slots

Package

dlist.

Source

dcons.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: prev
Readers

dcons-prev.

Writers

(setf dcons-prev).

Slot: data
Readers

dcons-data.

Writers

(setf dcons-data).

Slot: next
Readers

dcons-next.

Writers

(setf dcons-next).


Previous: , Up: Public Interface   [Contents][Index]

5.1.5 Classes

Class: dlist

A class that represents a doubly-linked list

Package

dlist.

Source

dlist.lisp.

Direct superclasses

sequence.

Direct methods
Direct slots
Slot: first
Package

common-lisp.

Initargs

:first

Readers

%dlist-first.

Writers

(setf %dlist-first).

Slot: last
Package

common-lisp.

Initargs

:last

Readers

%dlist-last.

Writers

(setf %dlist-last).


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Ordinary functions

Function: copy-dcons (instance)
Package

dlist.

Source

dcons.lisp.

Function: dcons-append (object dcons)

Creates a dcons whose ‘data’ is ‘object’ and appends it to ‘dcons’, returning ‘dcons’ with a pointer to the new dcons in ‘dcons”s next.

Package

dlist.

Source

dlist.lisp.

Reader: dcons-data (instance)
Writer: (setf dcons-data) (instance)
Package

dlist.

Source

dcons.lisp.

Target Slot

data.

Reader: dcons-next (instance)
Writer: (setf dcons-next) (instance)
Package

dlist.

Source

dcons.lisp.

Target Slot

next.

Function: dcons-p (object)
Package

dlist.

Source

dcons.lisp.

Reader: dcons-prev (instance)
Writer: (setf dcons-prev) (instance)
Package

dlist.

Source

dcons.lisp.

Target Slot

prev.

Function: dlist-cons-on (object dlist)

Returns a dlist whose elements are ‘object’ and the elements of ‘dlist’. ‘dlist’ is destructively mosified. This is intended to have the same use as @code{(cons object list)} for regular lists.

Package

dlist.

Source

dlist.lisp.

Function: make-dcons (&key prev data next)
Package

dlist.

Source

dcons.lisp.


5.2.2 Generic functions

Generic Reader: %dlist-first (object)
Package

dlist.

Methods
Reader Method: %dlist-first ((dlist dlist))

automatically generated reader method

Source

dlist.lisp.

Target Slot

first.

Generic Writer: (setf %dlist-first) (object)
Package

dlist.

Methods
Writer Method: (setf %dlist-first) ((dlist dlist))

automatically generated writer method

Source

dlist.lisp.

Target Slot

first.

Generic Reader: %dlist-last (object)
Package

dlist.

Methods
Reader Method: %dlist-last ((dlist dlist))

automatically generated reader method

Source

dlist.lisp.

Target Slot

last.

Generic Writer: (setf %dlist-last) (object)
Package

dlist.

Methods
Writer Method: (setf %dlist-last) ((dlist dlist))

automatically generated writer method

Source

dlist.lisp.

Target Slot

last.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %   (  
A   C   D   E   F   G   I   L   M   N   P   R  
Index Entry  Section

%
%dlist-first: Private generic functions
%dlist-first: Private generic functions
%dlist-last: Private generic functions
%dlist-last: Private generic functions

(
(setf %dlist-first): Private generic functions
(setf %dlist-first): Private generic functions
(setf %dlist-last): Private generic functions
(setf %dlist-last): Private generic functions
(setf data): Public ordinary functions
(setf dcons-data): Private ordinary functions
(setf dcons-next): Private ordinary functions
(setf dcons-prev): Private ordinary functions
(setf dlist-first): Public ordinary functions
(setf dlist-last): Public ordinary functions
(setf dlist-nth): Public ordinary functions
(setf elt): Public standalone methods
(setf iterator-element): Public standalone methods
(setf next): Public ordinary functions
(setf prev): Public ordinary functions

A
adjust-sequence: Public standalone methods

C
copy-dcons: Private ordinary functions
copy-dlist: Public ordinary functions

D
data: Public ordinary functions
dcons: Public ordinary functions
dcons-append: Private ordinary functions
dcons-data: Private ordinary functions
dcons-next: Private ordinary functions
dcons-p: Private ordinary functions
dcons-prev: Private ordinary functions
dconsp: Public ordinary functions
describe-object: Public standalone methods
dlist: Public ordinary functions
dlist->list: Public ordinary functions
dlist-append: Public ordinary functions
dlist-cons-on: Private ordinary functions
dlist-first: Public ordinary functions
dlist-last: Public ordinary functions
dlist-length: Public ordinary functions
dlist-nconc: Public ordinary functions
dlist-nth: Public ordinary functions
dlist-pop: Public macros
dlist-push: Public macros
dlist-reverse: Public ordinary functions
dlist=: Public ordinary functions
dlistp: Public ordinary functions
dodcons: Public macros
dodlist: Public macros

E
elt: Public standalone methods

F
Function, (setf data): Public ordinary functions
Function, (setf dcons-data): Private ordinary functions
Function, (setf dcons-next): Private ordinary functions
Function, (setf dcons-prev): Private ordinary functions
Function, (setf dlist-first): Public ordinary functions
Function, (setf dlist-last): Public ordinary functions
Function, (setf dlist-nth): Public ordinary functions
Function, (setf next): Public ordinary functions
Function, (setf prev): Public ordinary functions
Function, copy-dcons: Private ordinary functions
Function, copy-dlist: Public ordinary functions
Function, data: Public ordinary functions
Function, dcons: Public ordinary functions
Function, dcons-append: Private ordinary functions
Function, dcons-data: Private ordinary functions
Function, dcons-next: Private ordinary functions
Function, dcons-p: Private ordinary functions
Function, dcons-prev: Private ordinary functions
Function, dconsp: Public ordinary functions
Function, dlist: Public ordinary functions
Function, dlist->list: Public ordinary functions
Function, dlist-append: Public ordinary functions
Function, dlist-cons-on: Private ordinary functions
Function, dlist-first: Public ordinary functions
Function, dlist-last: Public ordinary functions
Function, dlist-length: Public ordinary functions
Function, dlist-nconc: Public ordinary functions
Function, dlist-nth: Public ordinary functions
Function, dlist-reverse: Public ordinary functions
Function, dlist=: Public ordinary functions
Function, dlistp: Public ordinary functions
Function, make-dcons: Private ordinary functions
Function, make-dlist: Public ordinary functions
Function, mapdcon: Public ordinary functions
Function, mapdcons: Public ordinary functions
Function, mapdlist: Public ordinary functions
Function, next: Public ordinary functions
Function, nthdcons: Public ordinary functions
Function, prev: Public ordinary functions

G
Generic Function, %dlist-first: Private generic functions
Generic Function, %dlist-last: Private generic functions
Generic Function, (setf %dlist-first): Private generic functions
Generic Function, (setf %dlist-last): Private generic functions

I
iterator-element: Public standalone methods
iterator-endp: Public standalone methods
iterator-index: Public standalone methods
iterator-step: Public standalone methods

L
length: Public standalone methods

M
Macro, dlist-pop: Public macros
Macro, dlist-push: Public macros
Macro, dodcons: Public macros
Macro, dodlist: Public macros
make-dcons: Private ordinary functions
make-dlist: Public ordinary functions
make-sequence-iterator: Public standalone methods
make-sequence-like: Public standalone methods
mapdcon: Public ordinary functions
mapdcons: Public ordinary functions
mapdlist: Public ordinary functions
Method, %dlist-first: Private generic functions
Method, %dlist-last: Private generic functions
Method, (setf %dlist-first): Private generic functions
Method, (setf %dlist-last): Private generic functions
Method, (setf elt): Public standalone methods
Method, (setf iterator-element): Public standalone methods
Method, adjust-sequence: Public standalone methods
Method, describe-object: Public standalone methods
Method, elt: Public standalone methods
Method, iterator-element: Public standalone methods
Method, iterator-endp: Public standalone methods
Method, iterator-index: Public standalone methods
Method, iterator-step: Public standalone methods
Method, length: Public standalone methods
Method, make-sequence-iterator: Public standalone methods
Method, make-sequence-like: Public standalone methods
Method, print-object: Public standalone methods
Method, reverse: Public standalone methods

N
next: Public ordinary functions
nthdcons: Public ordinary functions

P
prev: Public ordinary functions
print-object: Public standalone methods

R
reverse: Public standalone methods

Jump to:   %   (  
A   C   D   E   F   G   I   L   M   N   P   R  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   D   F   L   N   P   S  
Index Entry  Section

D
data: Public structures

F
first: Public classes

L
last: Public classes

N
next: Public structures

P
prev: Public structures

S
Slot, data: Public structures
Slot, first: Public classes
Slot, last: Public classes
Slot, next: Public structures
Slot, prev: Public structures

Jump to:   D   F   L   N   P   S