Very nitpicky but I find the ligatures on all the "t" characters very distracting.
Additionally, I don't know Closure, but are there any default hash-table implementations? If so, how does this implementation compare against the base one?
Clojure provides Persistent Hash Tries (look them up) as well as several other immutable map implementations. Mutable maps are provided by the Java base class libraries.
I love these posts. Even though I'd never use this in production, it's an excellent intro to the same basic data structure taught everywhere. But instead of mucking with a templated C++ implementation (or getting lost in the "plain cons cells for everything!" weeds)... Clojure! It also shows that as much as idiomatic Clojure frowns on OOP and mutability... it's not really that unpleasant to read. I almost want to go through all my old C++ assignments and redo them in Clojure like this.
Totally agree. Most Clojure code I read is far from easy to jump into for an amateur like myself. It is awesome to see some well-explained and simple code that you can learn from like this.
12 comments
[ 3.5 ms ] story [ 37.6 ms ] threadThat makes it sound like type hints are essentially mandatory for anything where performance matters.
Nice article! It would have been interesting to see how it fares against something like java.util.HashMap.
Additionally, I don't know Closure, but are there any default hash-table implementations? If so, how does this implementation compare against the base one?
Clojure provides Persistent Hash Tries (look them up) as well as several other immutable map implementations. Mutable maps are provided by the Java base class libraries.