-
Notifications
You must be signed in to change notification settings - Fork 253
Add a priority queue based on finger trees #279
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b947a4f
Added int min, int max and ord monoid. Added FingerTree empty and in…
mperry 6e5c822
Added show instances and toString implementations for finger trees
mperry 45abb41
Test show on finger trees to expose what is going on inside the finge…
mperry 8321b4f
Added streaming of finger trees
mperry a20a86e
Initial implementation of priority queue based on finger trees
mperry d630f99
Added priority queue show, toStream, toString. Fixed enqueue and deq…
mperry 6bd372b
Added functional to PriorityQueue
mperry 2a2b8ea
Added priority queue properties
mperry 1a7f3e6
Added finger tree toStream property?
mperry efd0bfb
Merge branch 'master' into pqueue
mperry e0839e1
Merge in upstream changes to remove arbitrary wrapper
mperry e3d8fce
Added priority queue and related methods javadoc
mperry c9788d4
Make sorting a list stable
mperry 72d980f
Added priority queue top N, equal to top, greater than top
mperry e5bc0e1
FIFO priority queue properties where the key is equal to the top key
mperry fc9f9bd
Added Ord.isLessThanOrEqualTo to Ord
mperry 3718313
Added asserts, remove commented out and printlns from FingerTreeTest
mperry a506f06
Implemented suggestons from @jbgi for PriorityQueue
mperry d2bd8cb
Added F1Functions#dimap (profunctor pattern)
jbgi d1f24b3
avoid andThen indirection in F1 map and contramap
jbgi 4351092
add an uncurried version of Function.apply for better perf.
jbgi 0704e22
Ord: Take better advantage of the curried comparison function.
jbgi 3812a83
Add uncons to FingerTree
jbgi f21c310
Add PriorityQueue.unqueue and use it to implement some other methods.
jbgi 24703d5
Merge pull request #2 from jbgi/pqueue
mperry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you have a use case for this? It is a valid instance but does not feel very mathematical as it rely on technicalities of integer representation limitations.
If I'm looking for a max value, I rarely want to default to
Integer.MIN_VALUE: I prefer to be explicit about the default and use the semigroup.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.
I'm using this monoid to annotate the nodes of the finger tree (the measured values) with integers and the max operation means the finger tree represents a priority queue.
The existing finger tree implementation uses a monoid to annotate the node, so I using it for that.