-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
make ifelse
generic
#32844
Comments
ifelse
generic
It used to be a generic function #27068 and eschnett/SIMD.jl#28 Maybe we can separate |
AFAIK we don't even need |
Sounds promising. :-) I think being able to specialize |
@gwater and me come to the conclusion that it's probably best to use @yuyichao, if ifelse(::Missing, a, b) = missing to Base? |
What if |
Assuming
It might actually recover some cases after an inconclusive result (which would currently throw a |
I agree, that seems elegant. |
Just curious, @KristofferC, why don't you like |
I'll explain for him. When we agreed to put |
Ah, right, I understand. @gwater and I were discussing whether we should use |
I don't know, and I understand the desire to use |
FWIW I also object to 1. making |
Ignoring the use-case for now, I'd say that I'd very much like for us to never export intrinsics/
|
I'm not sure which side of this I'm on. I'm generally against adding methods for
but with better 3VL support such that |
I understand the reluctance to use The specific use case that motivated this is the comparison of arithmetic intervals. They can be interpreted as numbers with an uncertainty, so comparisons do make sense. But when the intervals overlap, neither So the idea is to use three-valued logic: |
IMO that is not the problem --- if we want to allow adding methods to |
If it's not |
"Unordered" for floats seems relevant here (no language implements?).
I found that and quoted with link plus more on IEEE-754-2019 and potentially sqrt(-0.0) at: https://www.quora.com/Why-is-it-that-mathematicians-say-positive-zero-zero-and-negative-zero-In-the-book-I-am-reading-Calculus-for-Dummies-the-guy-used-negative-zeros-for-some-things-like-in-the-left-rectangle-rule/answer/Alon-Amit/comment/105579523 |
I agree we shouldn't add definitions for |
For symbolic libraries like ModelingToolkit, this is coming up because we want to be able to have the function |
Bumping this again. This issue seems to be one of the main recurring issues in ModelingToolkit, Pumas, etc. @chriselrod hit this the other day as well, because https://github.com/chriselrod/LoopVectorization.jl needs to define But this really raises the question: should Zygote, Flux, NNLib, LoopVectorization, ModelingToolkit, Pumas, SymbolicUtils, and probably more all be standardizing around a non-Base Pinging @chriselrod @AStupidBear @DhairyaLGandhi whom I know this has bitten. |
Could we go ahead and export a generic |
This along with Matt's comments in #32844 (comment) seem pretty convincing to me. I thought we should make this change so I made the obvious patch to separate builtin |
As suggested on discourse, I'd like to propose exporting
ifelse()
as a normal function rather than a builtin.We have a usecase in NumberIntervals.jl for extending
ifelse()
to do some three-value logic which is currently impossible for builtins.CC @yuyichao @oschulz
The text was updated successfully, but these errors were encountered: