A deep dive into implementing Clojure-style persistent data structures (HAMT hash maps, vectors, red-black trees, lists, and queues) in Fennel/Lua as part of the ClojureFnl project — a Clojure-to-Fennel compiler. The post covers design decisions like branching factors, the djb2 hashing algorithm, transients, lazy lists, and includes detailed benchmarks comparing persistent structures against native Lua tables on both PUC Lua 5.5 and LuaJIT.
Sort: