https://github.com/jsouthworth/immutable
Immutable data structures for go
https://github.com/jsouthworth/immutable
btree go hashmap list persistent-data-structure queue set stack treemap treeset vector
Last synced: 15 days ago
JSON representation
Immutable data structures for go
- Host: GitHub
- URL: https://github.com/jsouthworth/immutable
- Owner: jsouthworth
- License: 0bsd
- Created: 2019-01-17T20:59:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-11-14T15:26:20.000Z (about 4 years ago)
- Last Synced: 2024-06-21T13:13:32.495Z (over 1 year ago)
- Topics: btree, go, hashmap, list, persistent-data-structure, queue, set, stack, treemap, treeset, vector
- Language: Go
- Homepage:
- Size: 140 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Immutable
[](https://godoc.org/jsouthworth.net/go/immutable)
[](https://travis-ci.com/github/jsouthworth/immutable)
[](https://coveralls.io/github/jsouthworth/immutable?branch=master)
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](https://github.com/tonsky/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](https://jsouthworth.net/go/immutable)
## License
[LICENSE](LICENSE)
## Acknowledgments
* The Clojure project's implementation of these structures heavily influenced this implementation.
* [persistent-sorted-set](https://github.com/tonsky/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.