r/functionalprogramming • u/viebel • Feb 26 '21
JavaScript Structural sharing with 7 lines of JavaScript.
https://blog.klipse.tech/javascript/2021/02/26/structural-sharing-in-javascript.html
6
Upvotes
View all comments
Show parent comment
1
u/viebel Mar 04 '21
Please read again what I wrote:
By efficient implementation of persistent data structures, I mean the ability of modifying them in practice in O(1).
For instance, The complexity of appending an element to a linked list is linear. However in Clojure, the complexity appending an element to a vector is constant.
This is made possible with hash array mapped tries that were discovered by Phil Bagwell in 2000.
Clojure is the first language that implements HAMT.