simplify: no distinction between generic types and 'normal' types.

This commit is contained in:
Joeri Exelmans 2025-05-08 16:58:07 +02:00
parent b4826605af
commit a664ddac8a
27 changed files with 535 additions and 360 deletions

View file

@ -11,6 +11,15 @@ export const add = set => key => set.tree.get(key) === true ? set : new RBTreeWr
export const remove = set => key => new RBTreeWrapper(set.tree.remove(key));
export const length = set => set.tree.length;
export const fold = set => callback => initial => {
let acc = initial;
let iter = set.tree.begin;
while (iter !== undefined && iter.valid) {
acc = callback(acc, iter.key);
}
return acc;
};
export const first = set => set.tree.begin;
export const last = set => set.tree.end;