-
Couldn't load subscription status.
- Fork 1.4k
Optimize TPriorityQueue #3798
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
Optimize TPriorityQueue #3798
Conversation
| } | ||
| }, | ||
| testM("removeIf") { | ||
| val elems = List(2, 4, 6, 3, 5, 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could possibly choose the even numbers out of order here to show evidence that the priority matters (and similarly for odds)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to a property based test to cover that.
| */ | ||
| def takeAll: USTM[List[A]] = | ||
| map.size.flatMap(n => STM.collectAll(STM.replicate(n)(take))) | ||
| ref.modify(map => (map.flatMap { case (k, v) => List.fill(v)(k) }.toList, map.empty)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, v is the count reference of how many times k occurs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good.
|
@phderome Thank you for taking a look! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
No description provided.