Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Define vectorized get? #87

Open
Open
@quinnj

Description

I think it'd be really useful to have a NullableArray equivalent of get(A, default).

Something along the lines of:

function Base.get{T}(A::NullableArrays.NullableArray{T}, y)
    v = Array(T, size(A))
    for i in eachindex(v)
        if isbits(T)
            v[i] = ifelse(A.isnull[i], convert(T, y), A.values[i])
        else
            v[i] = A.isnull[i] ? convert(T, y) : A.values[i]
        end
    end
    return v
end

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions