Julia vs Python

Julia is a Python contender in the scientific field, each with an extensive library. Can a beginner replace an old one? (Python dates from 1991).

Démo Langage de programmation Julia
Julia Sample Code

Julia's development began in 2009, and the language became popularized when the compiler became open source in 2012. It is currently available under license from MIT. The goal is to create a language with the advantages of Python (simplicity and dynamism), R (statistical processing), C (execution speed), Perl (string processing), Mathlab (linear algebra) and others. He also wants to be distributed, generalized.
In Pascal's tradition, the name of the language comes from the French mathematician Gaston Julia, the discoverer of fractals.

Its simplicity and scientific capabilities make it a possible alternative to Python. But is he any better? It is usually significantly faster than Python, which uses C libraries to compensate for the slow interpreter. It is important to execute the algorithm, but the main thing is how they behave on large data sets, for example, matrix calculations. To the Benchmarks.
The advantage of Python is that libraries can also be written in Julia and compiled, while adding quick functions to Python requires using a different language.

Functions and syntax will also be mapped. Both languages ​ ​ want to be easy to understand and are addressed primarily to an audience that is not interested in hardware, and therefore in languages ​ ​ derived from C, such as Go, which are made to simplify the compiler task, and not increase the programmer's performance .

Similarity

Disagreements

Introduction to Julia syntax

Function

The definition starts with the function keyword and ends with end. This is usually, but not optimal, the Script language simplifies by completing the function with a return or return followed by a return value.

A function can also be defined by assigning a name expression with arguments. Exempli gratia:

fun(x) = x * 5

println(fun(2))

What 10 should show.

What is characteristic of this language is that the return value is the result of the last evaluated expression, unless the return statement is explicitly inserted into the function body.
Tables are passed by referencing arguments and can therefore be modified by a function call.

Operators are functions. You can assign the symbol + to the function f and call f (x, y), which returns the sum of the two arguments.

Control structures

The if structure is similar to that of PHP or Python .

Loop for shape:

for i = 1:n
 ... 
end 

Which is as simple as Python as with other syntax.

Iteration on the container, in the same form as in Script or other modern languages:

for s in [1, 2, 3]
 ... 
end

The while loop is classic:

while a < 5
  a += 5
end

There is no other control structure. No, no, no, no. Mattern is not considered by the creators .

Classes and homogeneity

Classes are compound types into which functions are nested, which thus become their methods.

type myclass 
   function f(x, y)
     ....
   end
end

There are no such prototypes as in JavaScript for dynamically adding members, but since the program can change and expand due to homogeneity, it should be possible to edit objects and add attributes and methods to them...

This is interpreted in the textbook, but the examples are not very vivid. At the moment, I believe that the eval function, as in JavaScript, allows you to evaluate and integrate the code into the program, and that there are various commands for "introspection," access to the code even in accordance with the data.

Should I

use Julia?

I'm really impressed with the possibilities of that language. You and Dart seem to have been developed at a different time. The python is left very far back, but he has an excuse that it was really developed at another time.
Yulia has all the capabilities of Python and even much more, the code is just as easy to write, it has similar libraries in the scientific field and therefore seems to be an alternative. It even allows you to use Python libraries.

But he's not perfect. Nothing is provided for mattern, something very developed in Scala, another modern and innovative language. Objects do not support inheritance or composition, which is widely used.
The documentation is brief and incomprehensible. Most examples are on the command line and are not very readable.
Error messages were mostly a weak point during my first attempt in 2014. Most errors within a function are marked on line 1, which is a string or begins with a function and is therefore difficult to find.
My experience of implementing the Erasthothenes criterion was time consuming at the time, but would have been easy with the current version.

Updated 23 April 2017

The language has changed a lot since the first test in 2014:


Julia Studio is a free EDI dedicated to this language.

Julia v. Python. Comparison of languages.

Julia On Wasm. How to compile Julia in WebAssembly. Experimental.

Links: Julia's website. Authors - Jeff Besanson, Stefan Karpinsky, Viral B. Shah, Alan Edelman.

Programming and dated languages - Asm.js- - BASIC- C- -C++ # C- - Darth-Eiffel - Guo- --JavaJavaScript--Julia PascalPHP- - - Python- - Prolog RubyLa ScalaScriptolSwift TypeScriptHTMLVasmXMLXAML SQL