Re: [julia-users] why do we have Base.isless(a, ::NAtype) but not Base.isless(a, ::Nullable)?

2016-10-14 Thread Milan Bouchet-Valat
Le jeudi 13 octobre 2016 à 15:40 +0200, Florian Oswald a écrit :
> i'm trying to understand why we don't have something similar in terms
> of comparison for Nullable as we have for DataArrays NAtype (below).
> point me to the relevant github conversation, if any, is fine. 
Such a method already exists in NullableArrays and in Julia 0.6. See
https://github.com/JuliaLang/julia/pull/18304


Regards

> How would I implement methods to find the maximium of an
> Array{Nullable{Float64}}? like so?
> 
> Base.isless(a::Any, x::Nullable{Float64}) = isnull(x) ? true :
> Base.isless(a,get(x))
> 
> 
> ~/.julia/v0.5/DataArrays/src/operators.jl:502
> 
> #
> # Comparison operators
> #
> 
> Base.isequal(::NAtype, ::NAtype) = true
> Base.isequal(::NAtype, b) = false
> Base.isequal(a, ::NAtype) = false
> Base.isless(::NAtype, ::NAtype) = false
> Base.isless(::NAtype, b) = false
> Base.isless(a, ::NAtype) = true
> 


[julia-users] why do we have Base.isless(a, ::NAtype) but not Base.isless(a, ::Nullable)?

2016-10-13 Thread Florian Oswald
i'm trying to understand why we don't have something similar in terms of
comparison for Nullable as we have for DataArrays NAtype (below). point me
to the relevant github conversation, if any, is fine.

How would I implement methods to find the maximium of an
Array{Nullable{Float64}}? like so?

Base.isless(a::Any, x::Nullable{Float64}) = isnull(x) ? true :
Base.isless(a,get(x))


~/.julia/v0.5/DataArrays/src/operators.jl:502

#
# Comparison operators
#

Base.isequal(::NAtype, ::NAtype) = true
Base.isequal(::NAtype, b) = false
Base.isequal(a, ::NAtype) = false
Base.isless(::NAtype, ::NAtype) = false
Base.isless(::NAtype, b) = false
Base.isless(a, ::NAtype) = true