Instead of a length-one array you can use `Ref` to hold a reference to
an object.
If you have multiple variables, then using a dictionary to hold the
values with either strings or symbols as keys might be the easiest
approach.
-erik
On Sun, Mar 27, 2016 at 1:13 PM, Fabian Gans
However, be aware that this only works in global scope:
function f()
z=2.0
change_variable(:z)
println(z)
end
f()
will print 2. If this is a problem, you might wrap your variable in an
array of size 1.
x=[2.0]
change_variable(x)=x[1]=3
On Saturday,
Hey Stefan,
I figured it out. I had to do something along these lines:
x = 2.0
function change_variable(z)
eval(:($z = 3.0))
end
change_variable(:x)
On Friday, March 25, 2016 at 12:00:50 PM UTC-7, Stefan Karpinski wrote:
>
> You may want to check out Interact.jl:
>
But I want to code in atom and render the chart with PyPlot, not jupyter
notebook.
Also, I would just like to know how to do this.
On Friday, March 25, 2016 at 12:00:50 PM UTC-7, Stefan Karpinski wrote:
>
> You may want to check out Interact.jl:
> https://github.com/JuliaLang/Interact.jl
>
>
You may want to check out Interact.jl:
https://github.com/JuliaLang/Interact.jl
On Fri, Mar 25, 2016 at 1:59 PM, Lewis Lehe wrote:
> Err that is
>
> slider[:on_changed](
>#WHERE I WANT THE MACRO TO GO
>variable = slider.val
> )
>
>
>
> On Friday, March 25, 2016 at
Err that is
slider[:on_changed](
#WHERE I WANT THE MACRO TO GO
variable = slider.val
)
On Friday, March 25, 2016 at 10:57:34 AM UTC-7, Lewis Lehe wrote:
>
> Hi,
> I am learning about metaprogramming and macros. I have a very basic case
> but am unsure about what Julia is capable of.