Skip to content

Commit

Permalink
Add ASCII alias compose of (JuliaLang/julia#33573)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Oct 16, 2019
1 parent ee09e5d commit 5e6c752
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `merge` methods with one and `n` `NamedTuple`s ([#29259]).

* Function composition `` now has an ASCII alias `compose` ([#33573]).

## Renaming

## New macros
Expand Down Expand Up @@ -131,3 +133,4 @@ includes this fix. Find the minimum version from there.
[#32628]: https://github.com/JuliaLang/julia/issues/32628
[#33129]: https://github.com/JuliaLang/julia/issues/33129
[#33568]: https://github.com/JuliaLang/julia/pull/33568
[#33573]: https://github.com/JuliaLang/julia/pull/33573
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ if VERSION < v"1.4.0-DEV.329"
Base.:(f, g, h...) = (f g, h...)
end

# https://github.com/JuliaLang/julia/pull/33573
if VERSION < v"1.4.0-DEV.330"
export compose
const compose =
end

include("deprecated.jl")

end # module Compat
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ end
end

# https://github.com/JuliaLang/julia/pull/33568
# https://github.com/JuliaLang/julia/pull/33573
@testset "function composition" begin
@test (x -> x-2, x -> x-3, x -> x+5)(7) == 7
fs = [x -> x[1:2], uppercase, lowercase]
@test (fs...)("ABC") == "AB"
@test (fs...) === compose(fs...)
end

nothing

0 comments on commit 5e6c752

Please sign in to comment.