This is cross posted which is making everyone duplicate their efforts. I gave a response here that matches a lot of what @Tamas_Papp says:
https://github.com/JuliaNLSolvers/Optim.jl/issues/482#issuecomment-341153635
But yes, a lot of this is just basic problems with not understanding programming (not Julia), and so I would recommend reading the manual on defining functions. You have to pass functions their arguments, otherwise it’s not clear what is even meant!