I've become addicted to Clojure's core data structures. When working in other languages, I try to stay true to their respective idioms, but occasionally, a few persistent data structures are exactly the right solution to the problem.
In particular, I'm looking for implementations of Phil Bagwell's vectors and array mapped tries (ie hash maps). Relevant libraries should include sets, queues, and sorted set/map variants for bonus points.
Haskell has a lot of persistent collections in various libraries, enough that it would be unseemly to list them here so I only mentioned the closest equivalent to Clojure's HAMTs.
I would like to see a 32-ary variation on unordered-containers that is more like Clojure though.
This one is part of my own library but I think I have to mention it because it is IMHO unique and very useful: PersistentTreeGrid. It offers:
It's fast enough to be used as the backing store for games (e.g. sparse storage of deformable 3D terrain).
It's written in Java, but I've used it successfully from other JVM languages.
For Python there is a library called pyrsistent (I'm the author). It focuses solely on persistent/functional data structures.
It contains implementations of persistent vector, map, set, record, bag, list, dequeue as well as type and invariant checked versions of the vector, map and set.
There are also a bunch of convenience functions for converting to/from the built in counterparts.
See the github page for more information and examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With