-
Notifications
You must be signed in to change notification settings - Fork 27
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 package doesn't use the total order predicates #40
Comments
You're talking about the implementations of What you're asking makes quite a bit of sense, but I find myself uneasy about examples like these: julia> isless(3, NaN)
true
julia> x = 1..NaN
1.0..NaN And now we vote: what should the answer for the following be? julia> 2 in x (Currently it gives |
Similarly, what is |
Shouldn’t that just be |
I kind of think of intervals as non-iterable sets, where |
(If |
I can’t imagine a case where you want that to work when there’s missings flying around.... |
Sorry, which to work, exactly? I think my point of view could be expressed like this: I don't see why the function below should ever throw an exception for iterable function f(iter)
for x in iter
if !(x in iter)
error("WTF!?")
end
end
end
f(Set(1,2,3,NaN,missing))
f([1,2,3,NaN,missing])
... Making the above be sane constrains both the behavior and the return type of |
@timholy I also find the example you gave a little unsettling, but it bothers me less than my example function above. |
To give a concrete example, I would really like to do |
I should have said earlier, the cases that interest me more are NaN in 1.0..10.0
missing in 1.0..10.0 |
I'm convinced, I agree with your argument (though your original examples |
I think the problem is that For intervals, one interesting case is |
It should be |
Also: julia> -0.0 in 0.0
true |
In AcceleratedArrays.jl I've been playing with "search intervals" for querying data, for example finding all the dates within a given range with the help of a sort-based acceleration index.
I've shied away from using this package because the predicates for total order used by sorting algorithms in Julia are
isequal
andisless
and the accelerations I rely on (e.g. this) may not be valid for<
and==
comparisons.I was wondering if there was a reason for chosing these operators, and whether or not we might consider it advantageous to use
isless
andisequal
instead?(One difficulty I have is dealing with data where some values are
missing
, where<
and==
aren't even predicates that returnBool
. In this case I still expectfindall(in(0..10), array::Array{Union{Int, Missing}})
to work correctly and not crash!)The text was updated successfully, but these errors were encountered: