4 ms·
I ported Chris Okasaki's red-black trees to JavaScript a little while ago: https://github.com/fitzgen/pfds-js/blob/master/red-black-trees.js https://github.com/
by mnemonik 15y ago
I ported Chris Okasaki's red-black trees to JavaScript a little while ago: https://github.com/fitzgen/pfds-js/blob/master/red-black-trees.js https://github.com/fitzgen/pfds-js/blob/master/red-black-tre...
- bajsejohannes 15y agoI think this illustrates how well pattern matching works for certain types of code. For the balance function, 7 lines of Qi becomes 45 lines of javascript. And I even think those 7 lines are easier to read.
- mnemonik 15y agoAgreed. I think it would become quite a bit simpler if this weren't persistent and you could just move some references around. But yes, it is very verbose.