diff --git a/README.md b/README.md index 113cee93e..e9df3bc8f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/src/Compat.jl b/src/Compat.jl index e4946a6d2..aaaca8aae 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 6e1f8b77c..0b9c56f50 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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