… and has always been, apparently. thanks for the reminder!
julia> VERSION
v"0.3.12"
julia> ∉
∉ (generic function with 1 method)
… and has always been, apparently. thanks for the reminder!
julia> VERSION
v"0.3.12"
julia> ∉
∉ (generic function with 1 method)
I think it would. You can define tanpi, but that’s ok; since it’s not an operator. notin
isn’t the best variable name, but you want it to still work if used. Assuming you couldn’t redefine, no more than:
julia> import Base.∉
julia> ∉ = 1
ERROR: cannot assign variable Base.∉ from module Main
it is simple to type, and is conventional enough.
It just mixes very awkwardly with in
. It would be so much narural with !in
.
It just mixes very awkwardly with
in
. It would be so much narural with!in
.
I agree it would be a good addition, but I prefer the style of in
for iteration, ∈
for inclusion, =
only for assignment, I saw that suggested somewhere as good style and happen to agree. That would mean that ∉
is only paired with ∈
, since for !(i in iterator)
isn’t going to get you much of anything you want.
=
only for assignment
Iteration is assignment. Each time around the loop it assigns the loop variable.
Iteration is assignment. Each time around the loop it assigns the loop variable.
I don’t disagree with what you’re saying, but did what I said actually strike you as unclear? It seems perfectly obvious what I mean, in context: assignment which isn’t a part of an iterated loop.
It seems better to have one syntax for assignment. I don’t see the benefit of adding a special syntax for assignment specifically for one particular context when it behaves exactly the same as a normal assignment.
It seems better to have one syntax for assignment.
That ship sailed a long time ago.
I don’t see the benefit of adding a special syntax for assignment specifically for one particular context when it behaves exactly the same as a normal assignment.
Great. I withdraw my plan to review your code and make you conform to my chosen style. It was a mistake to propose it in the first place.
julia> import Base.∉ julia> ∉ = 1 ERROR: cannot assign variable Base.∉ from module Main
I don’t understand your point. If you want to use ∉
as variable name, just don’t import the base version (and don’t refer to it)?
It’s the same with anything:
julia> import Base.tanpi
julia> tanpi = 1
ERROR: cannot assign a value to imported variable Main.tanpi