-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Base.minmax is almost the same, and IntervalSets.ordered is not used in IntervalSets.jl itself.
julia> using IntervalSets
julia> ordered(1,2)
(1, 2)
julia> minmax(1,2)
(1, 2)
julia> ordered(1.0,2)
(1.0, 2.0)
julia> minmax(1.0,2)
(1.0, 2.0)
julia> ordered("bc","ade")
("ade", "bc")
julia> minmax("bc","ade")
("ade", "bc")The only differences are type promotion and if-statement.
julia> ordered([2.0], [1,3])
([1.0, 3.0], [2.0])
julia> minmax([2.0], [1,3]) # does not promote
([1, 3], [2.0])IntervalSets.ordered uses ifelse.
https://github.com/JuliaMath/IntervalSets.jl/blob/master/src/IntervalSets.jl#L68
But Base.minmax uses ternary operator _?_:_
I'm not sure which implementation is ideal, but Base.minmax should be fixed if IntervalSets.ordered wins in some aspect, and I think we don't have to provide our ordered function.
Metadata
Metadata
Assignees
Labels
No labels