Adding an equivalent of in
consistent with isequal
#37157
Labels
collections
Data structures holding multiple items, e.g. sets
design
Design of APIs or of the language itself
speculative
Whether the change will be implemented is speculative
For CategoricalArrays's
recode
function, we bumped into the need for an equivalent ofin
which would always be consistent withisequal
(rather than sometimes following==
as it does forAbstractArray
notably). This is in order to allow things likerecode(array, [1, missing, NaN] => 0)
(equivalent toreplace(array, 1 => 0, missing => 0, NaN => 0)
).Currently, this works by special-casing an
AbstractArray
LHS to useisequal
, but it was requested that this should work with other collections, such as intervals (JuliaData/CategoricalArrays.jl#290). Both Intervals.jl and IntervalSets.jl definein
to be consistent with==
(likeAbstractArray
), i.e.missing in 0..1
returnsmissing
, so we cannot just usein
. Yet we don't want packages to depend on each other.It looks like we need a new function/method to complement
in
that would consistently useisequal
(maybe waiting for a deeper change in Julia 2.0). How does adding such a function sound? I imagine that could bein(isequal, a, b)
, or a completely new function.This issue was previously touched by discussion at #34744.
The text was updated successfully, but these errors were encountered: