-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requestsgood first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to Julia
Description
As discussed on Discourse, it would be nice to have !foo return a ComposedFunction, which would
- allow dispatch and specialized methods for
!foo - allow nicer pretty printing of
!fooas"!foo"rather than as"#xx (generic function with 1 method)"(by overloadingshowforComposedFunction{typeof(!)}) - allow
!!foo === foo
Although !foo and f ∘ g were introduced at the same time in #17155, when ∘ was subsequently updated in Julia 1.6 to return a special ComposedFunction type (#37517), the ! implementation was not correspondingly updated, which seems like an oversight.
On a related note, it would also be good to fix the ComposedFunction show method to put parentheses around operators (or other composed functions), as this is currently broken:
julia> (!) ∘ isnan
! ∘ isnan
julia> ! ∘ isnan
ERROR: syntax: "∘" is not a unary operator
Stacktrace:
[1] top-level scope
@ none:1Should be a fairly easy PR.
JeffBezanson
Metadata
Metadata
Assignees
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requestsgood first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to Julia