Re: [julia-users] Re: 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 à 06:45 -0700, Florian Oswald a écrit :
> I mean, do I have to cycle through the array and basically clean it
> of #NULL before findign the maximium or is there another way?
Currently you have two solutions:
julia> using NullableArrays

julia> x = NullableArray([1, 2, 3, Nullable()])
4-element NullableArrays.NullableArray{Int64,1}:
 1
 2
 3
 #NULL

julia> minimum(x, skipnull=true)
Nullable{Int64}(1)


Or:

julia> minimum(dropnull(x))
1


Regards

> > 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
> > 
> > 


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

2016-10-13 Thread Florian Oswald
ok i found the conversation here:

https://groups.google.com/d/topic/julia-users/W6yyV4i_W_k/discussion



On Thursday, 13 October 2016 15:45:23 UTC+2, Florian Oswald wrote:
>
> I mean, do I have to cycle through the array and basically clean it of 
> #NULL before findign the maximium or is there another way?
>
> On Thursday, 13 October 2016 15:42:02 UTC+2, Florian Oswald wrote:
>>
>> 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
>>
>>

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

2016-10-13 Thread Florian Oswald
I mean, do I have to cycle through the array and basically clean it of 
#NULL before findign the maximium or is there another way?

On Thursday, 13 October 2016 15:42:02 UTC+2, Florian Oswald wrote:
>
> 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
>
>