Book Image

Julia 1.0 Programming. - Second Edition

By : Ivo Balbaert
Book Image

Julia 1.0 Programming. - Second Edition

By: Ivo Balbaert

Overview of this book

The release of Julia 1.0 is now ready to change the technical world by combining the high productivity and ease of use of Python and R with the lightning-fast speed of C++. Julia 1.0 programming gives you a head start in tackling your numerical and data problems. You will begin by learning how to set up a running Julia platform, before exploring its various built-in types. With the help of practical examples, this book walks you through two important collection types: arrays and matrices. In addition to this, you will be taken through how type conversions and promotions work. In the course of the book, you will be introduced to the homo-iconicity and metaprogramming concepts in Julia. You will understand how Julia provides different ways to interact with an operating system, as well as other languages, and then you'll discover what macros are. Once you have grasped the basics, you’ll study what makes Julia suitable for numerical and scientific computing, and learn about the features provided by Julia. By the end of this book, you will also have learned how to run external programs. This book covers all you need to know about Julia in order to leverage its high speed and efficiency for your applications.
Table of Contents (17 chapters)
Title Page
Copyright and Credits
Packt Upsell


Julia is a now a well-established programming language. It was developed at MIT in the Applied Computing Group under the supervision of Prof. Alan Edelman. Its development started in 2009, and it was first presented publicly in February 2012. It has now reached its first production version: Julia v1.0 (published Aug 8, 2018), which means that stability is guaranteed for the complete duration of version 1. It is based on clear and solid principles, and its popularity is steadily increasing in the technical, data scientist, and high-performance computing arena.

Who this book is for

This book is intended for data scientists and all those who work on technical and scientific computation projects. It will get you up and running quickly with Julia to start simplifying your projects' applications. The book assumes you already have some basic working knowledge of a high-level dynamic language such as MATLAB, R, Python, or Ruby.

What this book covers

Chapter 1, Installing the Julia Platform, explains how to install all the necessary components for a Julia environment. It teaches you how to work with Julia's console (the REPL) and discusses some of the more elaborate development editors you can use.

Chapter 2, Variables, Types, and Operations, discusses the elementary built-in types in Julia and the operations that can be performed on them so that you are prepared to start writing code with them.

Chapter 3, Functions, teaches you why functions are the basic building blocks of Julia, and how to effectively use them.

Chapter 4, Control Flow, shows Julia's elegant control constructs, how to perform error handling, and how to use coroutines (called Tasks in Julia) to structure the execution of your code.

Chapter 5, Collection Types, explores the different types that group individual values, such as arrays and matrices, tuples, dictionaries, and sets.



Chapter 6, More on Types, Methods, and Modules, digs deeper into the type concept and how it is used in multiple dispatch to get C-like performance. Modules, a higher code organizing concept, are discussed as well.

Chapter 7, Metaprogramming in Julia, touches on deeper layers of Julia, such as expressions and reflection capabilities, and demonstrates the power of macros.

Chapter 8, I/O, Networking, and Parallel Computing, shows how to work with data in files and databases by using DataFrames. It also looks at networking capabilities, and how to set up a parallel computing environment with Julia.

Chapter 9, Running External Programs, looks at how Julia interacts with the command-line and with other languages, and also discusses performance tips.

Chapter 10, The Standard Library and Packages, digs deeper into the standard library, and demonstrates important packages for the visualization of data.

To get the most out of this book

To run the code examples in the book, you will need the Julia platform for your computer, which can be downloaded from To work more comfortably with Julia scripts, a development environment such as IJulia, Sublime Text, or Visual Studio Code is advisable. The first chapter contains detailed instructions on how to set up your Julia environment.

Download the example code files

You can download the example code files for this book from your account at If you purchased this book elsewhere, you can visit and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.


Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at Check them out!

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Add /Applications/ to make Julia available everywhere on your computer."

A block of code is set as follows:

for arg in ARGS 

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

mutable struct Point 

Any command-line input or output is written as follows:

julia> include("hello.jl")

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Start it up, go to Settings, and then Install Panel."


Warnings or important notes appear like this.


Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit


Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit