Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RangeMap.mergeCoalescing #3641

Open
perceptron8 opened this issue Oct 4, 2019 · 1 comment
Open

Add RangeMap.mergeCoalescing #3641

perceptron8 opened this issue Oct 4, 2019 · 1 comment
Labels

Comments

@perceptron8
Copy link
Contributor

Please consider addition of RangeMap.mergeCoalescing analogous to RangeMap.putCoalescing. It would be a great complement of RangeMap.merge.

I wish that you had choosen one-off coalesce operation rather than mutating one (see #2665), as it would be helpful in this use case as well.

@cpovirk cpovirk added the P3 label Oct 7, 2019
@perceptron8
Copy link
Contributor Author

perceptron8 commented Nov 6, 2023

I don't expect this comment to move things forward (quite the opposite probably?), but I'll leave it here as a memo anyway.

Although it's rather clear that
[[0..1)=1, [1..2)=0, [2..3)=1].mergeCoalescing([1..2), 1, (a, b) -> a + b)
should return
[0, 3) = 1
it's not clear at all whether
[[0..1)=1, [1..2)=0, [2..3)=0, [3..4)=0, [4..5)=1].mergeCoalescing([1..4), 1, (a, b) -> a + b)
should return
[[0..2)=1, [2..3)=1, [3..5)=1]
or
[[0..5)=1].

You've probably discovered this and much more similar flaws long time ago.

Surprisingly, I believe this seems to be an argument in favor of RangeMaps.coalesced
(#2665 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants