We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frommissing
This would be a parallel to the fromMaybe function in Data.Maybe in Haskell. The definition would be sorta like this:
fromMaybe
Data.Maybe
frommissing(default::T, value::Union{Missing, T}) where {T} = ismissing(value) ? default : value
The usage / tests could be as follows:
@test frommissing(4, missing) == 4 @test frommissing(4, 10) == 10 @test_throws MethodError frommissing(4, 10.0) # type mismatch @test frommissing.(4, [missing, 10]) == [4, 10]
Thoughts? Would a PR be accepted?
The text was updated successfully, but these errors were encountered:
This exists in Base as coalesce(value, default).
coalesce(value, default)
Sorry, something went wrong.
No branches or pull requests
This would be a parallel to the
fromMaybe
function inData.Maybe
in Haskell. The definition would be sorta like this:The usage / tests could be as follows:
Thoughts? Would a PR be accepted?
The text was updated successfully, but these errors were encountered: