-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
docs: add explanation to sort primop #14552
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4014,6 +4014,8 @@ static RegisterPrimOp primop_sort({ | |||||||||||||
|
|
||||||||||||||
| 1. Transitivity | ||||||||||||||
|
|
||||||||||||||
| If a is less than b; b is less than c. Then it follows that a is less than c | ||||||||||||||
|
|
||||||||||||||
| ```nix | ||||||||||||||
| comparator a b && comparator b c -> comparator a c | ||||||||||||||
| ``` | ||||||||||||||
|
|
@@ -4026,6 +4028,9 @@ static RegisterPrimOp primop_sort({ | |||||||||||||
|
|
||||||||||||||
| 1. Transitivity of equivalence | ||||||||||||||
|
|
||||||||||||||
| If a is NOT less than b; b is NOT less then a; a and b are equal according to the comparator. | ||||||||||||||
| If b is equal to c then it follows that a is equal to c | ||||||||||||||
|
Comment on lines
+4031
to
+4032
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think using different variables here make the prose much less confusing. Your version IMO made the mistake of extending the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, i can make the sentence more correct in that regard. But my other point was to avoid the term I also wonder if we need to define the |
||||||||||||||
|
|
||||||||||||||
| ```nix | ||||||||||||||
| let equiv = a: b: (!comparator a b && !comparator b a); in | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
| equiv a b && equiv b c -> equiv a c | ||||||||||||||
|
|
||||||||||||||
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.