Data Structures in Clojure: Binary Search Trees
macromancy.com
Data Structures in Clojure: Binary Search Trees
1–4 of 4 posts
Re: Data Structures in Clojure: Binary Search Trees
#2Mutable fields are really hard to use correctly in Clojure, but it's good to see an appropriate use case for `:volatile-mutable` in the implementation of these data structures.
Re: Data Structures in Clojure: Binary Search Trees
#3Clojure also has a built-in persistent red-black tree.
https://github.com/clojure/clojure/blob/master/src/jvm/cloju...
Re: Data Structures in Clojure: Binary Search Trees
#4Mutable fields are really hard to use correctly in Clojure, but it's good to see an appropriate use case for `:volatile-mutable` in the implementation of these data structures.
Mutable fields are really hard to use correctly in any language, and that's why Clojure encourages the use of immutable data. Thus I find it really odd that the article builds a mutable binary tree. The immutable version would have been equally simple. And now you can't put that tree into any of the Clojure's reference types (ref, agent, atom).