Closed kskalski closed 1 year ago
You can do that with update_many, just give it a function that always returns None
You can also implement retain with update_many, just pass the map itself as the elts and you'll visit every key in the map and have the option to remove it.
I'll consider adding convenience functions.
Thanks, this seems to work, except for the bug (https://github.com/estokes/immutable-chunkmap/issues/4) that I stumbled upon
remove_many added as a wrapper around update_many in 1.0.5
Following the availability of insert/update many it would be nice to also have something like
remove_many
. Alternatively (or also)retain
function (like in btree map) could be added to support such (and other) use-cases, though that one traverses the whole tree, so it could be too costly if removed set of keys is much smaller than overall keys in the tree.In my specific use-case I actually need to remove a range of keys, which I imagine might have a fast specialized implementation possible, but I suppose this could as well be a specific scenario possible to exploit in
remove_many
(as docs mentioninsert_many
being faster on sorted entries).And thanks for this lib, it looks pretty solid and performs very well!