-
Notifications
You must be signed in to change notification settings - Fork 94
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
add compare for sorted_set #1470
base: main
Are you sure you want to change the base?
add compare for sorted_set #1470
Conversation
Here are three observations and potential issues from the provided
These observations suggest that the |
Pull Request Test Coverage Report for Build 4741Details
💛 - Coveralls |
867625e
to
0a4e9dd
Compare
cc @hackwaly I remember you wrote one reasonably efficient version before? |
It's there: core/immut/sorted_set/generic.mbt Lines 64 to 77 in b45fcd7
|
I think the design principle for comparing containers in core is to compare the size first? |
I have one concern: Will structure-based comparisons affect the results of the comparison because of the order in which the nodes are inserted? I'll test that out later. |
I don't think so. Usually, but, here we can compare size first due to performance reason. |
I'm pretty sure we compare string with length first. Also, the length can always be traced for any container. |
dfs(self.root) | ||
if result != 0 { | ||
result | ||
} else { | ||
(self.size - other.size).to_int() | ||
} |
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.
Here we do dfs first and then compare length, which is weird.
The case is |
Do you mean comparing two type LazySeq () -> Int?
let a : LazySeq = fn () { Some(5) }
let b : LazySeq = fn () { Some(5) }
let c = a < b // <-- will you ever do that? |
No description provided.