Book Image

Getting Started with Julia

By : Ivo Balbaert
Book Image

Getting Started with Julia

By: Ivo Balbaert

Overview of this book

Table of Contents (19 chapters)
Getting Started with Julia
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The Rationale for Julia
Index

Standard modules and paths


The code of Julia packages (also called libraries) is contained in a module, whose name starts with an uppercase letter by convention like this:

   # see the code in Chapter 6\modules.jl
module Package1
# code
end

This serves to separate all its definitions from those in the other modules, so that no name conflicts occur. Name conflicts are solved by qualifying the function by the module name. For example, the packages Winston and Gadfly both contain a function plot. If needed these two versions in the same script, we would write this as follows:

import Winston
import Gadfly
Winston.plot(rand(4))
Gadfly.plot(x=[1:10], y=rand(10))

All variables defined in the global scope are automatically added to the Main module. Thus, when you write x = 2 in the REPL, you are adding the variable x to the Main module.

Julia starts with Main as the current top-level module. The module Core contains all built-in identifiers, and it is always available. The standard library is also available...