-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Feature request: {=}
alias for issetequal
#41428
Comments
Allowing braces as part of an identifier seems like a really bad decision. |
Maybe; what would you propose instead? |
I don't think this should have an ASCII symbol only alias. |
If there is a standard mathematical symbol for this that's in unicode, we should use that, but I don't think one exists. |
How about using
|
You can, in your own code, pick a infix Unicode operator and just use it. E.g.: julia> const ≃ = issetequal
issetequal (generic function with 4 methods)
julia> [1, 2] ≃ [2, 1, 2]
true This just isn't an operation that gets used enough to need special syntax for it. I do this sometimes when I'm writing code that does a lot of set differences with |
Hi, @StefanKarpinski, I just tried your method const ∖ = setdiff However, I got an error message LoadError: syntax: invalid character "∖" near column 7
syntax: invalid character "∖" near column 7
Stacktrace:
[1] top-level scope
@ In[37]:1
[2] eval
@ ./boot.jl:360 [inlined]
[3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1116 How can I fix this ? BTW, I use Julia 1.6.2 in Jupyter. I guess it is a problem of |
I see, thanks. Another question, what caused the |
As title says;
issetequal
is a bit long to type out and is unintuitive as a comparison operator, since statements likex==y
are usually written with infix notation.{=}
(or perhaps{==}
) should be intuitive, and it saves time when typing. Similarly,x {!==} y
andx {≠} y
would be great for set inequality. The latter would also be nice performance improvements over the current practice of using!issetequal()
, since it allows for short-circuit style evaluation: As soon as the function finds some element ofx
that is not an element ofy
, we can stop checking whether any other elements are inx
but noty
, since we have already proven the two sets are not equal by counterexample.The text was updated successfully, but these errors were encountered: