You can use a Ref
, like this:
julia> function mysum(f, itr)
sum = Ref(0.0)
fancy_iteration(itr) do pt
sum[] += f(pt)
end
sum[]
end
mysum (generic function with 1 method)
You can use a Ref
, like this:
julia> function mysum(f, itr)
sum = Ref(0.0)
fancy_iteration(itr) do pt
sum[] += f(pt)
end
sum[]
end
mysum (generic function with 1 method)