What is Julia?

Okay, so for the people who have not heard about Julia before and are probably thinking “Who is Julia?” or “What is Julia?” I will give you a quick idea of what it is.

Julia is a fairly new programming language that is creating a lot of buzz in the field of technical and scientific computing. But don’t be raising your brows after reading the terms like scientific computing, it can also be used for general purpose and web programming.

In the year 2009 by Jeff Bezanson, Stefan Karpinski, Viral B. Shah under the supervision of Prof. Alan Edelman started to develop Julia at MIT (Massachusetts Institute of Technology). Later, in the year 2012 it was released for public use.

Why do we need Julia?

I know most of you must be thinking why do I need to learn another programming language? What different can Julia offer me?

A one-liner answer to the above question would be:
Julia combines convenience with performance.

There is a quite common practice among programmers that most follow. 

  • When one wants to build something, they code the prototype using dynamic languages like Python, Ruby or R. These are also called RPL(Rapid Prototyping Languages)
  • Once the code is working flawlessly the slower running parts of the code are identified and  are written in compiled languages in C, C++ or Fortran
  • And finally if one is still not satisfied with the overall performance or is too concerned about the quality of the whole program, then the inner loops of the compiled language are rewritten  using assembler languages like CUDA, or OpenCL.

But, there’s a hurdle between the dynamic language and compiled, and another big hurdle between compiled language and assembly language. One has to learn three different languages to get the desired results, switch between the layers of abstraction and  write a considerable amount of verbose code.

Welcome Julia! This programming language is dynamic and easy to understand, is amazingly fast and the bonus is that it removes the barrier between the compiled and assembly language as well.

You can have a look at LLVM Intermediate Representation as well as its generated assembly code of any function defined — all within the REPL(same environment).

Here’s a quick example below for a simple function rectangle_area(x, y), that takes two parameters and returns their product value.

Some other notable features of Julia are mentioned below:

  • Sublime for  Technical computing and Scientific Computing.
  • Composable:

It allows to pass two or more functions as arguments. Julia has a dedicated function composition operator (∘) for achieving this.

julia> (sqrt ∘ +)(3, 5)


julia> sqrt(8)
  • Parallelism:

Julia was designed for parallelism from the very beginning, and provides built-in primitives for parallel computing.

  • Codebase is entirely written in Julia:

If you are developing applications in Julia, you can also contribute to the development of the programming language Julia. The base and the standard library is written in Julia itself, including proto-operations.

  • Call support to other languages:

If you wish to make use of C and Fortran libraries, it is very simple and efficient. This can be done using Julia’s ccall syntax, which looks like a standard function call. Julia can also interface with other languages, to share data between the two languages. It can also be embedded in other programs through its embedding API.

  • Optionally typed:

You can define functions with optional arguments, so that it can use defaults if specific parameters aren’t passed. A default symbol ($) and value in the argument list needs to be provided. For example:

julia> function print_params(x, y, z=0)
println("$x, $y, $z")
print_params (generic function with 2 methods)

When you call this function, if you don’t provide a third parameter, the value of z defaults to 0 and uses that value inside the function.

julia> print_params(1,2)
1, 2, 0
julia> print_params(1,2,3)
1, 2, 3
  • General-purpose programming:

Julia can also be used for writing software in a wide variety of application domains. It does not include language constructs designed to be used within a specific application domain. Julia lets you write UIs, compile your code statically and deploy it on a web server. It also has powerful shell-like capabilities for managing other processes.

So, this was all about the overview of Julia, hope you find it interesting and if you do, I am sure you must have tried writing some basic functions already.

In the next part of this article, we will dive a little deeper into Julia and start writing some basic functions and see how it works.