The huffman Reference Manual

Table of Contents

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

The huffman Reference Manual

This is the huffman Reference Manual, version 1.0, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Fri May 24 09:04:20 2019 GMT+0.


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

1 Introduction

Huffman Coding for Common Lisp

A very simple implementation of Huffman coding for Common Lisp.

Quickstart

Just use the huffman-encode and huffman-decode functions to encode and decode any Common Lisp sequence.

CL-USER > (huffman-encode "This is a test.")
#<HUFFMAN-CODING 46 bits, 9 unique values>

CL-USER > (huffman-encode '(0 3 4 4 6 2 1 6 2 6 0 6 7 7 7 6 0 9 5 1))
#<HUFFMAN-CODING 60 bits, 9 unique values>

The return value for huffman-encode is a huffman-coding object that contains the encoded bit-vector, a mapping of values to bits, and the type of the originally encoded sequence for the decoder.

The coding is then passed to huffman-decode to obtain the original sequence of values.

CL-USER > (huffman-decode *)
(0 3 4 4 6 2 1 6 2 6 0 6 7 7 7 6 0 9 5 1)

That's it.


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

2 Systems

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


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

2.1 huffman

Author

Jeffrey Massung

License

Apache 2.0

Description

Huffman encoding and decoding for Common Lisp.

Version

1.0

Source

huffman.asd (file)

Component

huffman.lisp (file)


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

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 files   [Contents][Index]

3.1.1 huffman.asd

Location

huffman.asd

Systems

huffman (system)

Packages

huffman-asd


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

3.1.2 huffman/huffman.lisp

Parent

huffman (system)

Location

huffman.lisp

Packages

huffman

Exported Definitions
Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 huffman-asd

Source

huffman.asd

Use List

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

4.2 huffman

Source

huffman.lisp (file)

Nickname

huff

Use List

common-lisp

Exported Definitions
Internal Definitions

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

5 Definitions

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


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

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: huffman-decode CODING

Decode a bit vector with a Huffman encoding map.

Package

huffman

Source

huffman.lisp (file)

Function: huffman-encode SEQ &optional MAP

Generate a Huffman map of values to bit encodings and encode the sequence.

Package

huffman

Source

huffman.lisp (file)

Function: huffman-map-sequence SEQ

Return a hash-table of Huffman codes from a sequence.

Package

huffman

Source

huffman.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Generic functions

Generic Function: huffman-coding-map OBJECT
Package

huffman

Methods
Method: huffman-coding-map (HUFFMAN-CODING huffman-coding)

automatically generated reader method

Source

huffman.lisp (file)

Generic Function: huffman-coding-sequence OBJECT
Package

huffman

Methods
Method: huffman-coding-sequence (HUFFMAN-CODING huffman-coding)

automatically generated reader method

Source

huffman.lisp (file)


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

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: copy-node INSTANCE
Package

huffman

Source

huffman.lisp (file)

Function: make-leaf VALUE &optional COUNT

Create a Huffman tree leaf node.

Package

huffman

Source

huffman.lisp (file)

Function: make-node &key (COUNT COUNT) (LEAF LEAF) (VALUE VALUE) (LEFT LEFT) (RIGHT RIGHT)
Package

huffman

Source

huffman.lisp (file)

Function: make-root LEFT RIGHT

Create a Huffman tree root node.

Package

huffman

Source

huffman.lisp (file)

Function: make-tree SEQ

Generate a Huffman tree from a sequence of data.

Package

huffman

Source

huffman.lisp (file)

Function: map-of-tree TREE

Return a hash-table mapping of values to bit-vector codes.

Package

huffman

Source

huffman.lisp (file)

Function: node-count INSTANCE
Function: (setf node-count) VALUE INSTANCE
Package

huffman

Source

huffman.lisp (file)

Function: node-leaf INSTANCE
Function: (setf node-leaf) VALUE INSTANCE
Package

huffman

Source

huffman.lisp (file)

Function: node-left INSTANCE
Function: (setf node-left) VALUE INSTANCE
Package

huffman

Source

huffman.lisp (file)

Function: node-p OBJECT
Package

huffman

Source

huffman.lisp (file)

Function: node-right INSTANCE
Function: (setf node-right) VALUE INSTANCE
Package

huffman

Source

huffman.lisp (file)

Function: node-value INSTANCE
Function: (setf node-value) VALUE INSTANCE
Package

huffman

Source

huffman.lisp (file)

Function: tree-of-map MAP

Return a binary tree of Huffman codes from a hash map.

Package

huffman

Source

huffman.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Generic functions

Generic Function: huffman-coding-type OBJECT
Package

huffman

Methods
Method: huffman-coding-type (HUFFMAN-CODING huffman-coding)

automatically generated reader method

Source

huffman.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Structures

Structure: node ()

Huffman tree node.

Package

huffman

Source

huffman.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: count
Readers

node-count (function)

Writers

(setf node-count) (function)

Slot: leaf
Readers

node-leaf (function)

Writers

(setf node-leaf) (function)

Slot: value
Readers

node-value (function)

Writers

(setf node-value) (function)

Slot: left
Readers

node-left (function)

Writers

(setf node-left) (function)

Slot: right
Readers

node-right (function)

Writers

(setf node-right) (function)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Classes

Class: huffman-coding ()

Return value from huffman-encode.

Package

huffman

Source

huffman.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: coding
Initargs

:coding

Readers

huffman-coding-sequence (generic function)

Slot: map
Initargs

:map

Readers

huffman-coding-map (generic function)

Slot: type
Initargs

:type

Readers

huffman-coding-type (generic function)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   H   L  
Index Entry  Section

F
File, Lisp, huffman.asd: The huffman<dot>asd file
File, Lisp, huffman/huffman.lisp: The huffman/huffman<dot>lisp file

H
huffman.asd: The huffman<dot>asd file
huffman/huffman.lisp: The huffman/huffman<dot>lisp file

L
Lisp File, huffman.asd: The huffman<dot>asd file
Lisp File, huffman/huffman.lisp: The huffman/huffman<dot>lisp file

Jump to:   F   H   L  

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

A.2 Functions

Jump to:   (  
C   F   G   H   M   N   T  
Index Entry  Section

(
(setf node-count): Internal functions
(setf node-leaf): Internal functions
(setf node-left): Internal functions
(setf node-right): Internal functions
(setf node-value): Internal functions

C
copy-node: Internal functions

F
Function, (setf node-count): Internal functions
Function, (setf node-leaf): Internal functions
Function, (setf node-left): Internal functions
Function, (setf node-right): Internal functions
Function, (setf node-value): Internal functions
Function, copy-node: Internal functions
Function, huffman-decode: Exported functions
Function, huffman-encode: Exported functions
Function, huffman-map-sequence: Exported functions
Function, make-leaf: Internal functions
Function, make-node: Internal functions
Function, make-root: Internal functions
Function, make-tree: Internal functions
Function, map-of-tree: Internal functions
Function, node-count: Internal functions
Function, node-leaf: Internal functions
Function, node-left: Internal functions
Function, node-p: Internal functions
Function, node-right: Internal functions
Function, node-value: Internal functions
Function, tree-of-map: Internal functions

G
Generic Function, huffman-coding-map: Exported generic functions
Generic Function, huffman-coding-sequence: Exported generic functions
Generic Function, huffman-coding-type: Internal generic functions

H
huffman-coding-map: Exported generic functions
huffman-coding-map: Exported generic functions
huffman-coding-sequence: Exported generic functions
huffman-coding-sequence: Exported generic functions
huffman-coding-type: Internal generic functions
huffman-coding-type: Internal generic functions
huffman-decode: Exported functions
huffman-encode: Exported functions
huffman-map-sequence: Exported functions

M
make-leaf: Internal functions
make-node: Internal functions
make-root: Internal functions
make-tree: Internal functions
map-of-tree: Internal functions
Method, huffman-coding-map: Exported generic functions
Method, huffman-coding-sequence: Exported generic functions
Method, huffman-coding-type: Internal generic functions

N
node-count: Internal functions
node-leaf: Internal functions
node-left: Internal functions
node-p: Internal functions
node-right: Internal functions
node-value: Internal functions

T
tree-of-map: Internal functions

Jump to:   (  
C   F   G   H   M   N   T  

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

A.3 Variables

Jump to:   C   L   M   R   S   T   V  
Index Entry  Section

C
coding: Internal classes
count: Internal structures

L
leaf: Internal structures
left: Internal structures

M
map: Internal classes

R
right: Internal structures

S
Slot, coding: Internal classes
Slot, count: Internal structures
Slot, leaf: Internal structures
Slot, left: Internal structures
Slot, map: Internal classes
Slot, right: Internal structures
Slot, type: Internal classes
Slot, value: Internal structures

T
type: Internal classes

V
value: Internal structures

Jump to:   C   L   M   R   S   T   V  

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

A.4 Data types

Jump to:   C   H   N   P   S  
Index Entry  Section

C
Class, huffman-coding: Internal classes

H
huffman: The huffman system
huffman: The huffman package
huffman-asd: The huffman-asd package
huffman-coding: Internal classes

N
node: Internal structures

P
Package, huffman: The huffman package
Package, huffman-asd: The huffman-asd package

S
Structure, node: Internal structures
System, huffman: The huffman system

Jump to:   C   H   N   P   S