Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.CESARUM.DICTIONARY

Implements a DICTIONARY API over HASH-TABLE, P-LIST, A-LIST and an ADAPTATIVE-DICTIONARY class that automatically switch between HASH-TABLE and A-LIST depending on the number of entries. License: AGPL3 Copyright Pascal J. Bourguignon 2010 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>

README:

FUNCTION

Private

TEST

Tests all the kinds of dictionary defined in this package.

Undocumented

TEST/DICTIONARY (TYPE)

GENERIC-FUNCTION

Public

DICTIONARY-COUNT (DICTIONARY)

RETURN: the number of associations in the DICTIONARY.

DICTIONARY-DELETE (DICTIONARY KEY)

Remove the KEY from the DICTIONARY.

DICTIONARY-GET (DICTIONARY KEY &OPTIONAL DEFAULT)

RETURN: The value associated with the KEY in the DICTIONARY.

DICTIONARY-MAP (FUN DICTIONARY)

Call the function FUN on each KEY VALUE association in the DICTIONARY.

DICTIONARY-SET (DICTIONARY KEY VALUE)

Enter or update the VALUE associated with the KEY into the DICTIONARY.

MAKE-DICTIONARY (TYPE &KEY TEST SIZE CONTENTS (CONTENTS 'NIL) (SIZE 8) (TEST #'EQL))

TYPE: Name of a class implementing the dictionary protocol. TEST: Restricted to EQL, EQUAL or EQUALP when type is HASH-TABLE. CONTENTS: A p-list containing the initial key value pairs.

Private

Undocumented

ADAPTATING-DICTIONARY-ADAPT (DICTIONARY)

SLOT-ACCESSOR

Public

ADAPTATING-DICTIONARY-LIMIT (DICTIONARY)

The The number of elements over which the adaptating DICTIONARY switches to hash-tables, and below which it switches to A-lists.

SETFADAPTATING-DICTIONARY-LIMIT (NEW-VALUE OBJECT)

Set the The number of elements over which the adaptating DICTIONARY switches to hash-tables, and below which it switches to A-lists.

DICTIONARY-DATA (DICTIONARY)

The The data in the dictionary.

SETFDICTIONARY-DATA (NEW-VALUE OBJECT)

Set the The data in the dictionary.

DICTIONARY-TEST (DICTIONARY)

The RETURN: The test function of the dictionary.

CLASS

Public

A-LIST

A dictionary implemented as an A-list.

ADAPTATING-DICTIONARY

A dictionary that changes between an A-list implementation and a hash-table implementation depending on the number of entries.

DICTIONARY-CLASS

An abstract Dictionary clas.

P-LIST

A dictionary implemented as a P-list.