jsouthworth / immutable

Immutable data structures for go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Immutable data structures for go

License:BSD Zero Clause License


Languages

Language:Go 100.0%