Great, thanks Mauro, most helpful.
On Friday, April 1, 2016 at 4:09:30 PM UTC+11, Mauro wrote:
>
> Maybe like so:
>
> julia> module Myfunc
> export f
> f(x) = g(x) * g(x)
> function g end
>end
>
> julia> using Myfunc
>
> julia> f(4)
> ERROR: MethodErr
Maybe like so:
julia> module Myfunc
export f
f(x) = g(x) * g(x)
function g end
end
julia> using Myfunc
julia> f(4)
ERROR: MethodError: `g` has no method matching g(::Int64)
in f at none:3
julia> Myfunc.g(x) = 2x
g (generic function with 1 method)
julia> f(
Hi all,
This works:
f(x) = g(x) * g(x)
g(x) = x + 1
f(2)# 9
That is, f(x) isn't fully defined until g is defined.
But if f(x) is in a module it doesn't work:
module myfunc
export f
f(x) = g(x) * g(x)
end
using myfunc
g(x) = x + 1
f(2) # ERROR: UndefVarError: g not defined
That is,