-
Notifications
You must be signed in to change notification settings - Fork 102
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
feat: merging functions on List + mergeSort #763
base: main
Are you sure you want to change the base?
Conversation
(i.e. for all `x`, `y`, `y'`, `z`, if `x < y < z` and `x < y' < z` then `x < merge y y' < z`) | ||
then the resulting list is again sorted. | ||
-/ | ||
def mergeDedupWith [Ord α] (merge : α → α → α) : (xs ys : List α) → List α |
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.
The merge
parameter is a bit confusing. How about dedup
, join
or meld
?
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.
combine
?
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.
or just f
. I think most of the other list functions don't give their predicate and function arguments long names, and while there are some downsides to having lots of one letter variables in context, one upside is that it makes it visibly distinct from global definitions. I assume that's the reason you flagged merge
as being a bad name...
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.
Yes, the issue is that merge
clashes with a definition in this file. I'm happy with f
, combine
or whatever you decide.
Co-authored-by: François G. Dorais <[email protected]>
Complement to #762. Adds List version of all the definitions in
Data.Array.Merge
. Also addsList.mergeSort
(upstreamed from mathlib), as a replacement forArray.qsort
on lists (becauseqsort
cannot easily be expressed as is).