Invalid redefinition of constant

i have a function where i define inside the following:

function relay(x,y,z)
block of code


funcQ(v)=qrs.prob(a,v,b)
return funcQ

then when i want to call the inner function, this happens
funcQ= relay(argument list)
i get this message:
invalid redefinition of constant funcQ

I can’t reproduce the error from the code you’ve given. Here’s a simplified version which works just fine:

julia> function relay(x, y, z)
         funcQ(v) = x + y + z + v
         return funcQ
       end
relay (generic function with 1 method)

julia> funcQ = relay(1, 2, 3)
funcQ (generic function with 1 method)

What probably happened is that you defined function funcQ(...) earlier in the same Julia session. Does the error persist if you restart Julia?

3 Likes

Yeah actually it worked after I restarted the kernel