A fast, lightweight, persistent AVL tree implementation written typescript.
npm install ravl
const {Tree} = require('ravl');
let a = new Tree();
function compare({key: a}, {key: b}) {
if (a < b) return -1;
if (a > b) return 1;
return 0;
}
let a = new Tree({compare})
a = a.add({key: 'a', value: 1});
a = a.add({key: 'b', value: 2});
a.has({key: 'b'}) // {key: 'a', value: 2}
a.has({key: 'c'}) // false
a = a.remove({key: 'b'});
let [{value}, newA] = a.take({key: 'c'});
Write in the org file. Export to markdown.