Making explicit the suggestion by @Jeff_Emanuel:
julia> mutable struct MyFun
k::Int64
end
julia> (f::MyFun)(a,b) = a * b + f.k
julia> myfun = MyFun(0);
julia> for k in 1:10
myfun.k = k
println(myfun(1,2))
end
3
4
5
6
7
8
9
10
11
12