-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requests
Description
Predicate function negation (source code) (proposed in #44748 and implemented in #44752) defines a method to simplify the case of !!f
to f
. Based on this, I propose implementing three similar simplifications.
Current
julia> !identity
!identity
julia> !!
!(!)
julia> !(identity ∘ !)
!(identity ∘ (!))
Proposed
julia> Base.:!(::typeof(identity)) = !;
julia> Base.:!(::typeof(!)) = identity;
julia> Base.:!(f::ComposedFunction{typeof(identity)}) = !f.inner;
julia> !identity
! (generic function with 7 methods)
julia> !!
identity (generic function with 1 method)
julia> !(identity ∘ !)
identity (generic function with 1 method)
As demonstrated, these methods can simplify several cases while preserving semantics. If this seems like a good idea, I'd be happy to make a PR.
nandoconde
Metadata
Metadata
Assignees
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requests