Skip to content

JoelLefkowitz/huffman

Repository files navigation

Huffman

Huffman coding. Lossless data compression.

Review Version Quality

Installing

spago install huffman

Documentation

Documentation and more detailed examples are hosted on Pursuit.

Usage

import Data.Huffman.Codewords (composeCodewords)
import Data.Huffman.Encode (decodeWith, encodeWith)

str = "A strongly-typed functional programming language that compiles to JavaScript"
codewords = composeCodewords str

>>> (
  " : 00110000 00110000 00110001"
  "-: 00110000 00110000 00110000 00110001 00110001 00110000"
  "A: 00110000 00110000 00110000 00110001 00110001 00110001"
  "J: 00110000 00110000 00110000 00110001 00110000 00110000"
  "S: 00110000 00110000 00110000 00110001 00110000 00110001"
  "a: 00110001 00110001 00110001 00110000"
  ...
)
encoded = encodeWith str codewords

>>> 000111001000001111100011001011101001001001000011011111001001011101001101000...
decoded = decodeWith encoded codewords

>>> "A strongly-typed functional programming language that compiles to JavaScript"

Tooling

Dependencies

To install dependencies:

yarn install
yarn spago install

Tests

To run tests:

yarn spago test

Documentation

To generate the documentation locally:

yarn spago docs

Linters

To run linters:

yarn lint

Formatters

To run formatters:

yarn format

Contributing

Please read this repository's Code of Conduct which outlines our collaboration standards and the Changelog for details on breaking changes that have been made.

This repository adheres to semantic versioning standards. For more information on semantic versioning visit SemVer.

Bump2version is used to version and tag changes. For example:

bump2version patch

Contributors

Remarks

Lots of love to the open source community!

Be kind to your mind Love each other It's ok to have a bad day