Hi Fellows,
module DDF
end
function DDF.foo(x::Int)
x+1
end
i want to define a function within DDF like foo.
How can i do that? The example above doesn’t work.
Hi Fellows,
module DDF
end
function DDF.foo(x::Int)
x+1
end
i want to define a function within DDF like foo.
How can i do that? The example above doesn’t work.
DDF.eval(:(function foo(x::Int)
x+1
end))
Note that this is usually bad style.
Better:
module DDF
function foo end # just define the generic function without any methods
end
function DDF.foo(x::Int) # add a method to DDF.foo
x+1
end