|
|
(12 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| __FORCETOC__
| |
| {{Infobox programming language
| |
| | name = Julia
| |
| | logo = Julia prog language.svg
| |
| | logo caption =
| |
| | screenshot = <!-- filename is enough -->
| |
| | screenshot caption =
| |
| | paradigm = [[multi-paradigm programming language|Multi-paradigm]]: [[multiple dispatch]] (core), [[procedural programming|procedural]], [[functional programming|functional]], [[metaprogramming|meta]], [[multistaged programming|multistaged]]<ref>{{cite web |url=https://medium.com/@acidflask/smoothing-data-with-julia-s-generated-functions-c80e240e05f3#.615wk3dle |title=Smoothing data with Julia's @generated functions |quote=Julia's generated functions are closely related to the multistaged programming (MSP) paradigm popularized by Taha and Sheard, which generalizes the compile time/run time stages of program execution by allowing for multiple stages of delayed code execution. |date=5 November 2015 |accessdate=9 December 2015}}</ref>
| |
| | released = {{Start date and age|2012}}<ref name="announcement"/>
| |
| | designer = Jeff Bezanson, [[Alan Edelman]], [[Stefan Karpinski]], [[Viral B. Shah]]
| |
| | developer = Jeff Bezanson, [[Stefan Karpinski]], [[Viral B. Shah]], and other contributors<ref name="license">{{cite web
| |
| | url = https://github.com/JuliaLang/julia/blob/master/LICENSE.md
| |
| | title = LICENSE.md
| |
| | publisher = [[GitHub]]
| |
| }}</ref><ref>{{cite web
| |
| | url = https://github.com/JuliaLang/julia/graphs/contributors
| |
| | title = Contributors to JuliaLang/julia
| |
| | publisher = [[GitHub]]
| |
| }}</ref>
| |
| | latest release version = 1.2.0<ref>{{cite web|author= |url=https://github.com/JuliaLang/julia/releases/tag/v1.2.0 |title=v1.2.0 |website=Github.com |date=2019-08-20 |accessdate=2019-08-20}}</ref>
| |
| | latest release date = {{Start date and age|2019|08|20|df=yes}}
| |
| | latest preview version = 1.3.0-rc2<ref>{{cite web|url=https://github.com/JuliaLang/julia/releases/tag/v1.3.0-rc2|title=v1.3.0-rc2 |website=GitHub|language=en|access-date=2019-09-13}}</ref>
| |
| | latest preview date = {{Start date and age|2019|09|12|df=yes}} / 1.4.0-DEV with daily updates
| |
| | typing = [[dynamic programming language|Dynamic]], [[nominal type system|nominative]], [[parametric polymorphism|parametric]], [[optional typing|optional]]
| |
| | implementations =
| |
| | dialects =
| |
| | influenced by = {{startflatlist}}
| |
| * [[C (programming language)|C]]<ref name="announcement"/>
| |
| * [[Lisp (programming language)|Lisp]]<ref name="announcement"/><!--only the parser implemented by femtolisp, a [[Scheme (programming language)|Scheme]]-like implementation (see: "unsupported" "julia --lisp" that invokes it, but its only influence on the language/syntax – Lisp-like macros? Maybe not even Lisp's CLOS "multimethods"? as Dylan with "multiple dispatch" was cut from the list-->
| |
| * [[Lua (programming language)|Lua]]<ref name="Introduction">{{Cite web|url=https://docs.julialang.org/en/stable/|title=<!--Chapter: Introduction under --> Home · The Julia Language|website=docs.julialang.org|language=en|access-date=2018-08-15}}</ref>
| |
| * [[Mathematica]]<ref name="announcement"/> (strictly its [[Wolfram Language]]<ref name="announcement"/><ref>{{cite web |url=https://fatiherikli.github.io/programming-language-network/ |title=Programming Language Network |publisher=GitHub |accessdate=6 December 2016}}</ref>)
| |
| * [[MATLAB]]<ref name="announcement"/>
| |
| * [[Perl]]<ref name="Introduction"/>
| |
| * [[Python (programming language)|Python]]<ref name="Introduction"/>
| |
| * [[R (programming language)|R]]<ref name="announcement"/>
| |
| * [[Ruby (programming language)|Ruby]]<ref name="Introduction"/>
| |
| * [[Scheme (programming language)|Scheme]]<ref name="JuliaCon2016">{{cite web |url=http://www.juliacon.org |title=JuliaCon 2016 |publisher=JuliaCon |quote="He has co-designed the programming language Scheme, which has greatly influenced the design of Julia"|accessdate=6 December 2016}}</ref>
| |
| {{endflatlist}}
| |
| | influenced =
| |
| | programming language = Julia, [[C (programming language)|C]],<!--"Remove when C11 is required for C code" https://github.com/JuliaLang/julia/search?utf8=%E2%9C%93&q=C11&type=
| |
|
| |
| "These roughly follows the c11/c++11 memory model [..] The only exception is the GC safepoint and GC state transitions [..] We use the compiler intrinsics to implement a similar API to the c11/c++11" https://github.com/JuliaLang/julia/blob/44f3d7c921cbe50105a54258db2febb65a4b9d44/src/julia_threads.h
| |
| --> [[C++]], [[Scheme (programming language)|Scheme]], [[LLVM]]<ref name="JuliaHome">{{cite web |url=https://julialang.org/ |title=Julia |author=<!--Staff writer(s); no by-line.--> |date=<!--None listed.--> |website=Julia |publisher=NumFocus project |access-date=9 December 2016 |quote=Julia's Base library, largely written in Julia itself, also integrates mature, best-of-breed open source C and Fortran libraries for ...}}</ref>
| |
| | platform = Tier 1: [[x86-64]], [[IA-32]], [[CUDA]]<br> Tier 2: [[ARM architecture|ARM]] (both 32- and 64-bit) and Tier 3: [[PowerPC]]<br> Also has web browser support (for [[JavaScript]] and [[WebAssembly]])<ref name="WebAssembly"/>
| |
| | operating system = [[Linux]], [[macOS]], [[Microsoft Windows|Windows]] and <!-- no longer just community support for --> [[FreeBSD]]
| |
| | license = [[MIT License|MIT]] (core),<ref name="license"/><!--for core language while, by default, "the environment, which consists of the language, user interfaces, and libraries, is under the GPL"--> [[General Public Licence|GPL v2]];<ref name="JuliaHome" /><ref>{{cite newsgroup|url=https://groups.google.com/forum/#!topic/julia-users/v4OjEK7azBs |title=Non-GPL Julia? |website=Groups.google.com |date= |accessdate=2017-05-31}}</ref><!--as some few libraries used by the standard library (that can be excluded) are [[copyleft]]--> a [[makefile]] option omits GPL libraries<ref>{{cite web |url=https://github.com/JuliaLang/julia/pull/10870 |title=Introduce USE_GPL_LIBS Makefile flag to build Julia without GPL libraries |quote=Note that this commit does not remove GPL utilities such as git and busybox that are included in the Julia binary installers on Mac and Windows.<!--dropped as of 0.5 then only libgit2--> It allows building from source with no GPL library dependencies.}}</ref>
| |
| | file ext = .jl
| |
| | website = {{Official website|https://JuliaLang.org|name=JuliaLang.org}}
| |
| }}
| |
|
| |
|
| Julia is a numerical computation and general purpose high-level programming language. | | Julia is a numerical computation and general purpose high-level programming language. |
| It's standout feature is its performance which allows libraries to be written in Julia directly. | | It's standout feature is its performance which allows libraries to be written in Julia directly. |
| In contrast, many libraries in [[R]] and [[Python]] are written in [[C]] or [[C++]] for performance purposes and accessed using Rcpp or Cython. | | In contrast, many libraries in [[R]] and [[Python]] are written in [[C (programming language)]] or [[C++]] for performance purposes and accessed using Rcpp or Cython. |
| If necessary, you can still interface with other languages. | | If necessary, you can still interface with other languages. |
| See [https://en.wikibooks.org/wiki/Introducing_Julia Introducing Julia] for a comprehensive guide on how to program in Julia. | | See [https://en.wikibooks.org/wiki/Introducing_Julia Introducing Julia] for a comprehensive guide on how to program in Julia. |
|
| |
|
|
| |
|
| =Installation= | | ==Installation== |
|
| |
|
| ===Juno=== | | ===Juno=== |
Line 62: |
Line 13: |
| Most items can be accessed from the Atom control palette <code>Ctrl + Shift + P</code><br> | | Most items can be accessed from the Atom control palette <code>Ctrl + Shift + P</code><br> |
| Shortcuts: | | Shortcuts: |
| * <code>Ctrl + Enter</code> Evaluate current selection | | * <code>Ctrl + Enter</code> Evaluate current selection/section. |
| * <code>Shift + Enter</code> Evaluate current section and jump to next. | | * <code>Shift + Enter</code> Evaluate current selection/section and jump to next. |
|
| |
|
| =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 103: |
Line 54: |
| ====Other Pkg Commands==== | | ====Other Pkg Commands==== |
| You can see all the commands by typing <code>?</code> in the package manager. | | You can see all the commands by typing <code>?</code> in the package manager. |
| | * <code>add [packagename]</code> Add a package |
| * <code>update [packagename]</code> Update a specific package or all packages | | * <code>update [packagename]</code> Update a specific package or all packages |
| * <code>remove [packagename]</code> Remove a package | | * <code>remove [packagename]</code> Remove a package |
| * <code>status</code> Show the current Pkg directory and installed packages | | * <code>status</code> Show the current Pkg directory and installed packages |
|
| |
|
| ==Basics== | | ===Basics=== |
| ===Strings=== | | ====Functions==== |
| ====String Interpolation==== | | You can chain functions using the pipe operator <code>|></code>. This is similar to <code>%>%</code> in [[R]] or <code>|></code> in [[F_sharp| F#]] |
| | <syntaxhighlight lang="julia> |
| | a = [1,2,3]; |
| | // Equivalent to sum(a) |
| | b = a |> sum |
| | |
| | </syntaxhighlight> |
| | ====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)" |
Line 115: |
Line 75: |
|
| |
|
| ====String Concatenation==== | | ====String Concatenation==== |
| | Julia uses <code>*</code> to concatenate strings. |
| | You will get an error if you use <code>+</code>. |
| <syntaxhighlight lang="julia"> | | <syntaxhighlight lang="julia"> |
| "a"*"b" | | "a"*"b" |
| </syntaxhighlight> | | </syntaxhighlight> |
|
| |
|
| ===Arrays=== | | ====Arrays==== |
| [[https://en.wikibooks.org/wiki/Introducing_Julia/Arrays_and_tuples Full details]] | | [[https://en.wikibooks.org/wiki/Introducing_Julia/Arrays_and_tuples Full details]] |
| <syntaxhighlight lang="julia"> | | <syntaxhighlight lang="julia"> |
Line 129: |
Line 91: |
| myArr = Array{Float64,1}(undef, 3) | | myArr = Array{Float64,1}(undef, 3) |
|
| |
|
| // Convert an iterable to an array with collect | | // Convert a collection to an array with collect |
| myArr = collect(1:3) | | myArr = collect(1:0.5:3) |
| | // myArr == [1.0,1.5,2.0,2.5,3.0] |
|
| |
|
| // Reference copy | | // Reference copy |
Line 168: |
Line 131: |
| 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 188: |
Line 151: |
| ==Machine Learning== | | ==Machine Learning== |
| {{Main|Machine Learning in Julia}} | | {{Main|Machine Learning in Julia}} |
| | | See [[Flux]] and [[Knet.jl]] |
|
| |
|
| ==Object Oriented Programming== | | ==Object Oriented Programming== |
Line 236: |
Line 199: |
| It includes convenience features including NN layers, activation functions, and an automatic differentiation system. | | It includes convenience features including NN layers, activation functions, and an automatic differentiation system. |
| See [[Machine Learning in Julia]] for more details on how to use Flux. | | See [[Machine Learning in Julia]] for more details on how to use Flux. |
|
| |
|
| |
|
| ===Latexify.jl=== | | ===Latexify.jl=== |
Line 242: |
Line 204: |
| Prints out a latex string for any Julia expression or value.<br> | | Prints out a latex string for any Julia expression or value.<br> |
| Very useful for printing out matrices to insert into Latex documents. | | Very useful for printing out matrices to insert into Latex documents. |
|
| |
|
| |
|
| |
|
| ==References== | | ==References== |
| {{Reflist}} | | {{Reflist}} |