diff --git a/README.md b/README.md index 2ebf30e..ce124d5 100644 --- a/README.md +++ b/README.md @@ -33,12 +33,12 @@ julia> Pkg.add("BroadcastMapConversion") ````julia using Base.Broadcast: broadcasted -using BroadcastMapConversion: mapped +using BroadcastMapConversion: Mapped, mapped using Test: @test a = randn(2, 2) bc = broadcasted(*, 2, a) -m = mapped(bc) +m = Mapped(bc) m′ = mapped(x -> 2x, a) @test copy(m) ≈ map(m.f, m.args...) @test copy(m) ≈ copy(m′) diff --git a/examples/README.jl b/examples/README.jl index c2bd44d..7c5a01c 100644 --- a/examples/README.jl +++ b/examples/README.jl @@ -38,12 +38,12 @@ julia> Pkg.add("BroadcastMapConversion") # ## Examples using Base.Broadcast: broadcasted -using BroadcastMapConversion: mapped +using BroadcastMapConversion: Mapped, mapped using Test: @test a = randn(2, 2) bc = broadcasted(*, 2, a) -m = mapped(bc) +m = Mapped(bc) m′ = mapped(x -> 2x, a) @test copy(m) ≈ map(m.f, m.args...) @test copy(m) ≈ copy(m′) diff --git a/src/BroadcastMapConversion.jl b/src/BroadcastMapConversion.jl index d8a4a87..0b6bb5e 100644 --- a/src/BroadcastMapConversion.jl +++ b/src/BroadcastMapConversion.jl @@ -73,7 +73,6 @@ function map_broadcast_to_mapped(bc::Broadcasted) return Mapped(bc.style, bc.f, bc.args, bc.axes) end -mapped(bc::Broadcasted) = Mapped(bc) mapped(f, args...) = Mapped(broadcasted(f, args...)) Base.similar(m::Mapped, elt::Type) = similar(Broadcasted(m), elt) diff --git a/test/test_basics.jl b/test/test_basics.jl index 0cec553..4ad29d0 100644 --- a/test/test_basics.jl +++ b/test/test_basics.jl @@ -1,5 +1,5 @@ using Base.Broadcast: broadcasted -using BroadcastMapConversion: mapped +using BroadcastMapConversion: Mapped, mapped using Test: @test, @testset @testset "BroadcastMapConversion (eltype=$elt)" for elt in ( @@ -12,7 +12,7 @@ using Test: @test, @testset (broadcasted(*, c, a), mapped(x -> c * x, a), c * a), (broadcasted(+, a, broadcasted(*, c, b)), mapped((x, y) -> x + c * y, a, b), a + c * b), ) - m = mapped(bc) + m = Mapped(bc) @test copy(m) ≈ ref @test copy(m′) ≈ ref @test map(m.f, m.args...) ≈ ref