This is neat! I was really hoping to see some of the underlying clojure data structures implemented in rust – but I don’t think that’s one of the author’s goals as of now.
For context, Clojure uses some clever persistent data structures for hash maps and vectors. (Here’s a snippet of Rick Hickey giving an overview of some data structures). The implementation here currently implements persistent vectors as Vec<Rc<T>>, and maps are associated lists instead.
There is a persistent hash trie crate in rust, and there may be other persistent structures that could be used. I’d love to see how this project develops, and if it takes the route of using these data structures.
im (https://docs.rs/im/14.3.0/im/) is a collection of all of those types, in a threadsafe and a non-threadsafe version.
Hey there, author here. I indeed plan to eventually implement the appropriate efficient data structures, as they are implemented in Clojure – or use a library like im. In fact, everything you see will likely change – I’m taking a very iterative approach to this altogether. That particular alist-implemented map is a tide-me-over map for small datasets, implemented at the last minute, and for now is analogous to Clojure’s PersistentArrayMap, which it will likely be replaced with.
Awesome! I’m really exited to hear you’re working on this :)