immutable

module
v0.0.0-...-e62b5e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2021 License: 0BSD

README

Immutable

GoDoc Build Status Coverage Status

This library implements several persistent datastructures for the go programming language. A vector based on Radix Balanced Trees with some optimizations adapted from Clojure. A HAMT based hashmap inspired heavily by Clojure's hashmap. A B-Tree based treemap based on the B-Tree implementation used in persistent-sorted-set.

Several additional overlay data-structures are provided for conveience. A list, queue, stack, hashset, and treeset are built on top of the 3 basic data-structures.

One of the goals of this library is to feel as idomatic in go as it can. Forced boxing of the values is alliviated by using reflection to call functions of the appropriate type where appropriate.

The APIs of the various implementations can be considered stable. Only extensions will be made to them.

Getting started

go get jsouthworth.net/go/immutable

Usage

The full documentation is available at jsouthworth.net/go/immutable

License

LICENSE

Acknowledgments

  • The Clojure project's implementation of these structures heavily influenced this implementation.
  • persistent-sorted-set influenced the btree implementation used to back treemap and treeset.

TODO

  • Performance benchmarking and improvements. Performance is acceptable but can problably be made better.
  • Add JSON marshalling support.

Directories

Path Synopsis
Package hashmap implements a persistent HAMT based hashmap.
Package hashmap implements a persistent HAMT based hashmap.
Package hashset implements an immutable Set datastructure on top of hashmap A note about Value equality.
Package hashset implements an immutable Set datastructure on top of hashmap A note about Value equality.
internal
btree
Package btree implements a persistent B+Tree
Package btree implements a persistent B+Tree
Package list implements a persistent linked list.
Package list implements a persistent linked list.
Package queue implements a persistent FIFO queue.
Package queue implements a persistent FIFO queue.
Package stack implements a persistent stack.
Package stack implements a persistent stack.
Package treemap implements a map on top of a persistent B-tree.
Package treemap implements a map on top of a persistent B-tree.
Package treeset implements an immutable Set datastructure on top of treemap A note about Value comparability, by default, go's comparison operators will be used for any comparable type.
Package treeset implements an immutable Set datastructure on top of treemap A note about Value comparability, by default, go's comparison operators will be used for any comparable type.
Package vector implements a Radix Balanced trie based vector.
Package vector implements a Radix Balanced trie based vector.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL