-
Notifications
You must be signed in to change notification settings - Fork 243
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
This commit updates container_loops.jl to use the new iteration protocol #426
Conversation
(introduced in 0.7.0-DEV) more thoroughly. It is not compatible with 0.6. In addition, it fixes a bug in container_loops.jl in which the length() function when applied to subranges (i.e., inclusive(a,b,c) or exclusive(a,b,c)) returned the length of the whole container instead of the length of the subrange. (There should be no value returned for the length of the subrange since the data structure does not support an O(1) algorithm or even O(log n) algorithm to compute the length.) Some other smaller changes in this commit are as follows. IntSet was changed to BitSet (name change in 0.7.0-DEV) Small updates to documentation Some assert statements in balanced_tree.jl that were present during development are deleted.
I forgot to include in the commit message: this PR also rewrites |
Codecov Report
@@ Coverage Diff @@
## master #426 +/- ##
=========================================
- Coverage 98.19% 98.09% -0.1%
=========================================
Files 30 30
Lines 1658 1573 -85
=========================================
- Hits 1628 1543 -85
Misses 30 30
Continue to review full report at Codecov.
|
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.
LGTM, although I’m on my phone and can’t review the changes to test_sortrd_containers.jl
src/balanced_tree.jl
Outdated
if p1 == p2 | ||
if i1a == t.tree[p1].child1 | ||
@assert(t.tree[p1].child2 == i2a || t.tree[p1].child3 == i2a) | ||
# @assert(t.tree[p1].child2 == i2a || t.tree[p1].child3 == i2a) |
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 think you’ll ever uncomment these again? If not, then it’s better to just delete them.
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 curdepth commented out lines can be removed though. They are not asserts
I won't ever uncomment those statements, but they do indicate invariants satisfied by the algorithm that may assist someone else in deciphering the code. Is there a better way to indicate (with a comment) a program invariant? |
Ok, I removed the commented-out asserts. The |
I don’t know of a specific convention regarding invariants, but it would be nice to document them as such, to distinguish them from commented our code. Perhaps add |
I am sorry, I think I have miscommunicated. I would not have deleted them.
Which for now just effectively comment out their contents. The other reason not to delete them is while we may later wish to inform the compiler of these facts later for optimisation purposes. |
OK, I backed out the last commit using
|
I believe this calls for |
As @oxinabox said, |
1f5fee4
to
8ac6dd4
Compare
Bump. @StephanVavasis, is this good to go? Do you need to force push? |
Should be good to go... there are now no-op macros to indicate program invariants. |
This commit rewrites container_loops.jl to incorporate the new iteration protocol
(introduced in 0.7.0-DEV) more thoroughly. It is not compatible with 0.6.
In addition, it fixes a bug in container_loops.jl in which the length()
function when applied to subranges (i.e., inclusive(a,b,c) or
exclusive(a,b,c)) returned the length of the whole container instead
of the length of the subrange. (There should be no value returned
for the length of the subrange since the data structure does not support
an O(1) algorithm or even O(log n) algorithm to compute the length.)
Some other smaller changes in this commit are as follows.