simplify: no distinction between generic types and 'normal' types.
This commit is contained in:
parent
b4826605af
commit
a664ddac8a
27 changed files with 535 additions and 360 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue