Invalid redefinition of constant

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