Skip to content

Can't Define New Functors Using Numeric Extensions 0.6.2 in Julia 0.3.3 #49

@mikewojnowicz

Description

@mikewojnowicz

Hi everyone,
I am an R and MATLAB user who is moving to Julia. I am trying the Numeric Extensions package. In the documentation (http://numericextensionsjl.readthedocs.org/en/latest/functors.html), they show an example of how to define a new functor:
type SqrDiff <: Functor{2} end

NumericExtensions.evaluate(::SqrDiff, x, y) = abs2(x - y)

However, when I try to apply this new functor, I get this result:

julia> type SqrDiff <: Functor{2} end
julia> NumericExtensions.evaluate(::SqrDiff, x, y) = abs2(x - y)
evaluate (generic function with 143 methods)
julia> x=ones(4)_5
julia> y=ones(4)_2
julia> map(SqrDiff(),x,y)
ERROR: SqrDiff not defined
julia> map(NumericExtensions.SqrDiff(),x,y)
ERROR: SqrDiff not defined

Any ideas about what the problem is? I have no problem with

julia> map(NumericExtensions.Multiply(),x,y)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions