Sunteți pe pagina 1din 5

Julia (programming language)

Automatic generation of ecient, specialized code


for dierent argument types

Julia is a high-level dynamic programming language designed to address the requirements of high-performance
numerical and scientic computing while also being effective for general-purpose programming,[12][13][14][15]
web use[16][17] or as a specication language.[18] Distinctive aspects of Julias design include a type system with
parametric types in a fully dynamic programming language and multiple dispatch as its core programming
paradigm. It allows concurrent, parallel and distributed
computing, and direct calling of C and Fortran libraries without glue code. Julia is garbage-collected,[19]
uses eager evaluation and includes ecient libraries for
oating-point calculations, linear algebra, random number generation, fast Fourier transforms and regular expression matching.

Elegant and extensible conversions and promotions


for numeric and other types
Ecient support for Unicode, including but not limited to UTF-8
Multiple dispatch (also known as multimethods in Lisp)
is a generalization of single dispatch the polymorphic
mechanism used in common object oriented (OO) languages that uses inheritance. In Julia, all concrete types
are subtypes of abstract types, directly or indirectly subtypes of the Any type, which is the top of the type hierarchy. Concrete types can not be subtyped, but composition is used over inheritance, that is used by traditional
object-oriented languages (see also Inheritance vs subtyping).

Language features

Julia draws signicant inspiration from various dialects


According to the ocial website, the main features of the of Lisp, including Scheme and Common Lisp, and it
language are:
shares many features with Dylan (such as an ALGOLlike free-form inx syntax rather than a Lisp-like prex
Multiple dispatch: providing ability to dene func- syntax, while in Julia everything[23] is an expression)
tion behavior across many combinations of argu- also a multiple-dispatch-oriented dynamic language and
Fortress, another numerical programming language with
ment types
multiple dispatch and a sophisticated parametric type sys Dynamic type system: types for documentation, op- tem. While CLOS adds multiple dispatch to Common
timization, and dispatch
Lisp, not all functions are generic functions.
Good performance, approaching that of statically- In Julia, Dylan and Fortress extensibility is the default,
and the systems built-in functions are all generic and extyped languages like C
tensible. In Dylan, multiple dispatch is as fundamental
Built-in package manager
as it is in Julia: all user-dened functions and even basic
Lisp-like macros and other metaprogramming facil- built-in operations like + are generic. Dylans type system, however, does not fully support parametric types,
ities
which are more typical of the ML lineage of languages.
Call Python functions:
use the PyCall By default, CLOS does not allow for dispatch on Common Lisps parametric types; such extended dispatch
package[lower-alpha 1]
semantics can only be added as an extension through
Call C functions directly: no wrappers or special the CLOS Metaobject Protocol. By convergent design,
APIs
Fortress also features multiple dispatch on parametric
Powerful shell-like capabilities for managing other types; unlike Julia, however, Fortress is statically rather
than dynamically typed, with separate compilation and
processes
execution phases. The language features are summarized
Designed for parallelism and distributed computa- in the following table:
tion
Julias syntactic macros (used for metaprogramming),
like Lisp macros, are more powerful and dierent from
text-substitution macros used in the preprocessor of some
User-dened types are as fast and compact as built- other languages such as C, because they work at the level
ins
of abstract syntax trees (ASTs). Julias macro system is
Coroutines: lightweight green threading

4 NOTES

hygienic, but also supports deliberate capture when de- faster than Python or R).[29] Development of Julia besired (like for anaphoric macros) using the esc construct. gan in 2009 and an open-source version was publicized
in February 2012.[4][30]

Interaction

Julia, the 0.5.x line, is on a monthly release schedule


where bugs are xed and some new features from 0.6-dev
are backported (and possibly also to 0.4.x).

The Julia ocial distribution includes an interactive session shell, called Julias REPL, which can be used to experiment and test code quickly.[24] The following frag- 3.1 Current and future platforms
ment represents a sample session on the REPL:[25]
[31]
[32]
julia> p(x) = 2x^2 + 1; f(x, y) = 1 + 2p(x)y julia> While Julia uses JIT (MCJIT from LLVM) Julia
println(Hello world!", " I'm on cloud ", f(0, 4), " as generates native machine code, directly, the rst time a
Julia supports recognizable syntax!") Hello world! I'm function is run (not a bytecode that is run on a VM, as
with e.g. Java/JVM or Java/Dalvik in Android).
on cloud 9 as Julia supports recognizable syntax!
Current support is for 32- and 64-bit (all except for
The REPL gives user access to the system shell and to ancient pre-Pentium 4-era, to optimize for newer) x86
help mode, by pressing ; or ? after the prompt (preceding processors (and with download of executables or source
each command), respectively. The REPL also keeps the code also available for other architectures). Experhistory of commands, even between sessions. For other imental and early support for ARM, AARCH64, and
[33]
Including
examples, see the Julia documentation,[26] which gives POWER (little-endian) is available too.
Raspberry
Pi
1
and
later
(e.g.
requires
at
support
for
code that can be tested inside the Julias interactive sec[34][35]
least
armv6").
tion or saved into a le with a .jl extension and run from
the command line by typing (for example):[27]
Support for GNU Hurd is being worked on.[36]
$ julia <lename>
Julia version 0.6 is planned for 2016 and 1.0 for 2017 and
Julia is also supported by Jupyter, an online interac- some features are discussed for 2+ that is also planned,
[37]
tive notebooks environment (project Jupyter is a multi- e.g. "multiple inheritance for abstract types.
language extension, that evolved, from the IPython
command shell; now includes IJulia). See for other ways
in the next section.
3.2 Julia2C source-to-source compiler
A Julia2C source-to-source compiler from Intel Labs is
available.[38] This source-to-source compiler is a fork of
Julia, that implements the same Julia language syntax,
Julias ccall keyword is used to call C-exported or Fortran which emits C code (for compatibility with more CPUs)
shared library functions individually.
instead of native machine code, for functions or whole
Julia has Unicode 9.0 support, with UTF-8 used for programs. The compiler is also meant to allow analyzing
[39]
source code (and by default for strings) and e.g. option- code at a higher level than C.
ally allowing common math symbols for many operators, Intels ParallelAccelerator.jl can be thought of as a parsuch as for the in operator.
tial Julia to C++ compiler, but the objective is parallel

2.1

To use Julia with other languages

Julia has packages supporting markup languages such as speedup (can by 100x over plain Julia, for the older
[40]
and could in cases also speed up serial
HTML, (and also for HTTP), XML, JSON and BSON. 0.4 version,
code manyfold for that version), not compiling the full
language to C++ (its only an implementation detail, that
may be dropped later). It needs not compile all syntax, as
3 Implementation
the rest is handled by Julia.
Julias core is implemented in C and C++ (the LLVM dependency is in C++), its parser in Scheme (femtolisp),
and the LLVM compiler framework is used for justin-time (JIT) generation of 64-bit or 32-bit optimized
machine code (i.e. not for VM[28] ) depending on the platform Julia runs on. With some exceptions (e.g., libuv),
the standard library is implemented in Julia itself. The
most notable aspect of Julias implementation is its speed,
which is often within a factor of two relative to fully optimized C code (and thus often an order of magnitude

4 Notes
[1] Calling newer Python 3 also works[20][21] (and PyPy[22] )
and calling in the other direction, from Python to Julia, is
also supported with pyjulia. Even calling recursively (back
and forth) between these languages is possible, without (or
with) using Polyglot.jl, that supports additional languages
to Python.

References

[1] Smoothing data with Julias @generated functions. 5


November 2015. Retrieved 9 December 2015. Julias 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.
[2] LICENSE.md. GitHub.
[3] Contributors to JuliaLang/julia. GitHub.
[4] Why We Created Julia. Julia website. February 2012.
Retrieved 7 February 2013.

[22] Polyglot.jl. wavexx. github.com.


[23] Learn X in Y minutes: Where X=Julia at learnxinyminutes.com
[24] Julia REPL documentation
[25] See also: http://julia.readthedocs.org/en/latest/manual/
strings/ for string interpolation and the string(greet, ", ",
whom, ".\n) example for preferred ways to concatenate
strings. While the + operator is not used for string concatenation, it could easily be dened to do so. Julia has
the println and print functions, but also a @printf macro,
while not in a function form, to eliminate run-time overhead of formatting (unlike the same function in C).

[5] http://julialang.org/downloads/

[26] Julia Documentation.


November 2014.

[6] http://julialang.org/downloads/oldreleases.html

[27] Learn Julia in Y Minutes

[7] https://github.com/JuliaLang/julia/releases/tag/v0.5.0

[28] Chris Lattner discusses the name LLVM. Retrieved 22


December 2011.

[8] https://julialang.org
[9] Non-GPL Julia?
[10] Introduce USE_GPL_LIBS Makele ag to build Julia
without GPL libraries. 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.
It lets you build from source without any GPL library dependencies.
[11] http://julia.readthedocs.org/en/latest/manual/
introduction/
[12] The Julia Language (ocial website).
[13] Bryant, Avi (15 October 2012). Matlab, R, and Julia:
Languages for data analysis. O'Reilly Strata.
[14] Krill, Paul (18 April 2012). New Julia language seeks to
be the C for scientists. InfoWorld.
[15] Finley, Klint (3 February 2014). Out in the Open: Man
Creates One Programming Language to Rule Them All.
Wired.
[16] Escher lets you build beautiful interactive Web UIs in Julia. Retrieved 27 July 2015.
[17] Getting Started with Node Julia. node-julia.
[18] Moss, Robert (26 June 2015). Using Julia as a Specication Language for the Next-Generation Airborne Collision Avoidance System. Archived from the original on
1 July 2015. Retrieved 29 June 2015. Airborne collision
avoidance system
[19] Suspending Garbage Collection for Performance...good
idea or bad idea?".
[20] PyCall.jl. stevengj. github.com.
[21] Using PyCall in julia on Ubuntu with python3. juliausers at Google Groups. to import modules (e.g. python3numpy)

julialang.org.

Retrieved 18

[29] Julia: A Fast Dynamic Language for Technical Computing (PDF). 2012.
[30] Gibbs, Mark (9 January 2013). Pure and Julia are cool
languages worth checking out. Network World (column).
Retrieved 7 February 2013.
[31] Support MCJIT. Retrieved 26 May 2015.
[32] Using MCJIT with the Kaleidoscope Tutorial. 22 July
2013. Retrieved 26 May 2015.
[33] https://github.com/JuliaLang/julia/blob/v0.5.0/
README.md
[34] Cross-compiling for ARMv6. Retrieved 16 May 2015.
I believe #10917 should x this. The CPU used there
arm1176jzf-s.
[35] ARM build failing during bootstrap on Raspberry Pi 2.
Retrieved 16 May 2015. I can conrm (FINALLY) that it
works on the Raspberry Pi 2 [..] I guess we can announce
alpha support for arm in 0.4 as well.
[36] https://github.com/JuliaLang/openlibm/pull/129
building tests on GNU/kFreeBSD and GNU/Hurd
[37] https://github.com/JuliaLang/julia/issues/6975
faces for Abstract Types

Fix
Inter-

[38] https://github.com/IntelLabs/julia/tree/j2c/j2c
[39] Julia2C initial release. By translating Julia to C, we
leverage the high-level abstractions (matrix, vector, ..),
which are easier to analyze, and can potentially add the
rich extensions of C (like openmp, tbb, ...).
The tool may also extend Julia to new architectures where
the only available tool chain is for C
[..]
Translation from C to Julia might be harder.
[40] Lindsey Kuper (1 Mar 2016). An introduction to ParallelAccelerator.jl.

External links
Ocial website
The Julia manual
Julia Package Listing a searchable listing of all
(currently over 1100) registered packages

EXTERNAL LINKS

Text and image sources, contributors, and licenses

7.1

Text

Julia (programming language) Source: https://en.wikipedia.org/wiki/Julia_(programming_language)?oldid=742216158 Contributors:


Edward, BlackGrien, Graue, Stevenj, Glenn, Bearcat, Giftlite, Macrakis, Pavel Vozenilek, Comtebenoit, Jonsafari, Stefan.karpinski,
Waldir, Graham87, Qwertyus, Svaksha, Mahlon, Bgwhite, Peterl, TexasAndroid, Arthur Rubin, Cedar101, Chris the speller, Dl2000,
Msnicki, Tomgreep, Omarkonsul, PeteX, Openlander, Gioto, Wllm, Magioladitis, Connor Behan, DGG, McSly, Rwessel, Tambora1815, Brvman, Varnent, Econterms, X-Fi6, Go2Null, LoVVgE, Sfan00 IMG, Therealgandalf, Qwfp, Joswig, Nate Wessel, Luckas-bot,
AnomieBOT, Jim1138, Wickorama, Jonas AGX, Xan2, Amaury, Sanpitch, Skyerise, Cnwilliams, Orenburg1, Horcrux92, Dourouc05,
ZroBot, Ethaniel, Veikk0.ma, Elaz85, Donner60, ChuispastonBot, Aurelien.desbrieres, Mattsenate, Mikhail Ryazanov, ClueBot NG,
Helpful Pixie Bot, BG19bot, Jan Spousta, Exercisephys, IluvatarBot, Rwgambill, BattyBot, Xmikus01, MichaelSchumacherMercedes, Codename Lisa, Mogism, DavidPKendal, Lgfcd, Mark viking, Sjkelly, Pdecalculus, Jodosma, Voddan, Captain Conundrum, RaphaelQS,
Brk0 0, Comp.arch, Eman541, Tpoisot, Iaindunning, ScotXW, Monkbot, Bub250, Stillmorepeople, Equinox, Oberrron, RobertJMoss,
Crazypiemonkey, GreenC bot and Anonymous: 74

7.2

Images

File:Commons-logo.svg Source: https://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg License: CC-BY-SA-3.0 Contributors: ? Original artist: ?


File:Folder_Hexagonal_Icon.svg Source: https://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg License: Cc-bysa-3.0 Contributors: ? Original artist: ?
File:Julia_prog_language.svg Source: https://upload.wikimedia.org/wikipedia/commons/6/69/Julia_prog_language.svg License: Public
domain Contributors: Vector taken from https://groups.google.com/forum/#!topic/julia-dev/g2fe8L9dkwg, converted text to path, and
cropped Original artist: Stefan Karpinski
File:Portal-puzzle.svg Source: https://upload.wikimedia.org/wikipedia/en/f/fd/Portal-puzzle.svg License: Public domain Contributors: ?
Original artist: ?
File:Symbol_book_class2.svg Source: https://upload.wikimedia.org/wikipedia/commons/8/89/Symbol_book_class2.svg License: CC
BY-SA 2.5 Contributors: Mad by Lokal_Prol by combining: Original artist: Lokal_Prol
File:Symbol_list_class.svg Source: https://upload.wikimedia.org/wikipedia/en/d/db/Symbol_list_class.svg License: Public domain Contributors: ? Original artist: ?
File:Symbol_neutral_vote.svg Source: https://upload.wikimedia.org/wikipedia/en/8/89/Symbol_neutral_vote.svg License: Public domain Contributors: ? Original artist: ?
File:Wikibooks-logo-en-noslogan.svg Source: https://upload.wikimedia.org/wikipedia/commons/d/df/Wikibooks-logo-en-noslogan.
svg License: CC BY-SA 3.0 Contributors: Own work Original artist: User:Bastique, User:Ramac et al.

7.3

Content license

Creative Commons Attribution-Share Alike 3.0

S-ar putea să vă placă și