Jump to content

Julia: Difference between revisions

95 bytes added ,  25 September 2019
no edit summary
No edit summary
No edit summary
Line 56: Line 56:




==Installation==
=Installation=


===Juno===
===Juno===
Line 65: Line 65:
* <code>Shift + Enter</code> Evaluate current section and jump to next.
* <code>Shift + Enter</code> Evaluate current section and jump to next.


==Basic Usage==
=Usage=
===Package Management===
==Package Management==
[https://www.simonwenkel.com/2018/10/06/a-brief-introduction-to-package-management-with-julia.html Guide]
[https://www.simonwenkel.com/2018/10/06/a-brief-introduction-to-package-management-with-julia.html Guide]
====Initializing a new project====
====Initializing a new project====
Line 107: Line 107:
* <code>status</code> Show the current Pkg directory and installed packages
* <code>status</code> Show the current Pkg directory and installed packages


===String Interpolation===
==Basics==
===Strings===
====String Interpolation====
<syntaxhighlight lang="julia">
<syntaxhighlight lang="julia">
"Variable x is $x, y is $y, and x+y is $(x+y)"
"Variable x is $x, y is $y, and x+y is $(x+y)"
</syntaxhighlight>
====String Concatenation====
<syntaxhighlight lang="julia">
"a"*"b"
</syntaxhighlight>
</syntaxhighlight>


Line 161: Line 168:
You can also use the full <code>function(a,b)</code> syntax.
You can also use the full <code>function(a,b)</code> syntax.


===Animation Loop===
==Animation Loop==
You can use [https://docs.julialang.org/en/v1/base/base/#Base.Timer-Tuple{Function,Real} <code>Timer(callback, delay, interval)</code>]. This is similar to SetInterval in JavaScript.<br>
You can use [https://docs.julialang.org/en/v1/base/base/#Base.Timer-Tuple{Function,Real} <code>Timer(callback, delay, interval)</code>]. This is similar to SetInterval in JavaScript.<br>
End the loop with [https://docs.julialang.org/en/v1/base/io-network/#Base.close <code>close(animate)</code>].
End the loop with [https://docs.julialang.org/en/v1/base/io-network/#Base.close <code>close(animate)</code>].
Line 171: Line 178:




===Graphics===
==Graphics==
{{Main|Graphics in Julia}}
{{Main|Graphics in Julia}}
You can use MeshCat.jl to create visualizations to view in a web browser.<br>
You can use MeshCat.jl to create visualizations to view in a web browser.<br>
Line 179: Line 186:
MeshCat.jl is built using [https://github.com/JuliaGizmos/WebIO.jl WebIO.jl].<br>
MeshCat.jl is built using [https://github.com/JuliaGizmos/WebIO.jl WebIO.jl].<br>


===Machine Learning===
==Machine Learning==
{{Main|Machine Learning in Julia}}
{{Main|Machine Learning in Julia}}




===Object Oriented Programming===
==Object Oriented Programming==
Julia is a [https://en.wikipedia.org/wiki/Multiple_dispatch Multiple Dispatch] language.<br>
Julia is a [https://en.wikipedia.org/wiki/Multiple_dispatch Multiple Dispatch] language.<br>
You can use a <code>struct</code> in place of classes and define methods which use your struct as a parameter.<br>
You can use a <code>struct</code> in place of classes and define methods which use your struct as a parameter.<br>