Skip to content

let mapc support Number types #207

Open
@johnnychen94

Description

julia> mapc(*, x, y)
ERROR: MethodError: no method matching _same_colorspace(::Float64, ::Float64)
Stacktrace:
 [1] mapc(::typeof(*), ::Float64, ::Float64) at /Users/jc/.julia/packages/ColorTypes/GHtY7/src/operations.jl:107
 [2] top-level scope at REPL[4]:1

julia> mapc(*, Gray(x), Gray(y))
Gray{Float64}(0.013853760001569756)

I believe this helps unify how we process AbstractArray{<:AbstractGray} and AbstractArray{<:Number}.

We basically only need to define mapc(op, x::Number, y::Number) = op(x, y)

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions