Hi,
I'd like this code:
function f1()
x = 1
if !isdefined(:x)
x = 2
end
println(x)
end
function f2()
if !isdefined(:x)
x = 2
end
println(x)
end
f1() # prints 2, ideally should print 1
f2() # prints 2, ideally should print 2
ideally to print:
1
2
The problem is that isdefined works at global scope only... I've found a
trick here: https://groups.google.com/forum/#!topic/julia-dev/HgEPayeJnDM
by Simon Kornblith, but I've been unable to adapt it to my case... Is there
a way to do what I want?
Many thanks,