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

dequeue for PriorityQueue should return Key-Value Pair not just Key #845

Closed
micampbell opened this issue Feb 2, 2023 · 6 comments
Closed

Comments

@micampbell
Copy link

Generally, the dequeue operation is to retrieve the value in a path-planning tree search. As currently implemented, one needs to call peek() to get to the "best" value (best is lowest or highest depending on direction), followed by dequeue!() to remove it. This is cumbersome and inefficient (two calls to get "best").
make dequeue! return the same as peek

@hdavid16
Copy link

There is dequeue_pair! to do this. However, I do agree that it makes sense to just have dequeue! do this.

@micampbell
Copy link
Author

I didn't know of dequeue_pair!. That solves it, but this semantic choice is antithetical to all other programming languages.

@hdavid16
Copy link

hdavid16 commented Apr 27, 2023

I totally agree with you! I would recommend keeping this issue open since this syntax is not ideal for users.

@micampbell micampbell reopened this Apr 27, 2023
@micampbell
Copy link
Author

well, if you think it isn't too late to change....re-opened

@hdavid16
Copy link

It looks like #479 removes these and replaces them with popfirst!, which behaves as dequeue_pair!. This is to conform with Julia base.

@aoanla

This comment was marked as off-topic.

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

No branches or pull requests

3 participants