Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restore default constant value in Julia

According to docs, in Julia I can do the following:

julia> pi
π = 3.1415926535897...

julia> pi = 3
Warning: imported binding for pi overwritten in module Main
3

How can I resore pi back to it's proper value?

like image 426
alex Avatar asked Jul 06 '14 11:07

alex


1 Answers

You can access the original under Base.pi:

julia> pi
π = 3.1415926535897...

julia> pi = 3
Warning: imported binding for pi overwritten in module Main
3

julia> Base.pi
π = 3.1415926535897...

julia> pi = Base.pi;

julia> pi
π = 3.1415926535897...

julia> cos(pi)
-1.0
like image 62
DSM Avatar answered Sep 20 '22 01:09

DSM