has there been discussion about including a notnan function and its analogs like notnothing in the Base library? I frequently find myself doing things like
filter(x -> !isnan(x), Y)
where it would be nice to simply
filter(notnan, Y)
I always consider putting the definitions in a startup file but then I would have to remember that if I share code.
julia> !isnan
#84 (generic function with 1 method)
so writing !isnan returns a function already. This is documented behaviour of !:
help?> !
(...)
!f::Function
Predicate function negation: when the argument of ! is a function, it returns a function which computes the boolean negation of f.
julia> methods(!)
# 3 methods for generic function "!":
[1] !(f::Function) in Base at operators.jl:1117
[2] !(x::Bool) in Base at bool.jl:35
[3] !(::Missing) in Base at missing.jl:101
Curious why !(f::Function) is defined as !(f::Function) = (x...)->!f(x...) instead !(f::Function) = (!) ∘ f in Base? The latter would allow dispatching on these negated functions.