0% found this document useful (0 votes)
23 views

Julia Quick Syntax Reference: A Pocket Guide for Data Science Programming 1st Edition Antonello Lobianco - Read the ebook now with the complete version and no limits

The document promotes the 'Julia Quick Syntax Reference: A Pocket Guide for Data Science Programming' by Antonello Lobianco, available for download at textbookfull.com. It outlines the book's content, which covers essential Julia programming concepts, data types, control flow, custom types, input/output operations, and interfacing with other languages. Additionally, it highlights the importance of the Julia package ecosystem and provides resources for further learning and updates.

Uploaded by

guiercondy1h
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Julia Quick Syntax Reference: A Pocket Guide for Data Science Programming 1st Edition Antonello Lobianco - Read the ebook now with the complete version and no limits

The document promotes the 'Julia Quick Syntax Reference: A Pocket Guide for Data Science Programming' by Antonello Lobianco, available for download at textbookfull.com. It outlines the book's content, which covers essential Julia programming concepts, data types, control flow, custom types, input/output operations, and interfacing with other languages. Additionally, it highlights the importance of the Julia package ecosystem and provides resources for further learning and updates.

Uploaded by

guiercondy1h
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Explore the full ebook collection and download it now at textbookfull.

com

Julia Quick Syntax Reference: A Pocket Guide for


Data Science Programming 1st Edition Antonello
Lobianco

https://textbookfull.com/product/julia-quick-syntax-
reference-a-pocket-guide-for-data-science-programming-1st-
edition-antonello-lobianco-2/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

Julia Quick Syntax Reference: A Pocket Guide for Data


Science Programming 1st Edition Antonello Lobianco

https://textbookfull.com/product/julia-quick-syntax-reference-a-
pocket-guide-for-data-science-programming-1st-edition-antonello-
lobianco-2/
textbookfull.com

C# 7 Quick Syntax Reference: A Pocket Guide to the


Language, APIs, and Library Mikael Olsson

https://textbookfull.com/product/c-7-quick-syntax-reference-a-pocket-
guide-to-the-language-apis-and-library-mikael-olsson/

textbookfull.com

C++17 quick syntax reference: a pocket guide to the


language, APIs and library Third Edition Olsson

https://textbookfull.com/product/c17-quick-syntax-reference-a-pocket-
guide-to-the-language-apis-and-library-third-edition-olsson/

textbookfull.com

Haskell Quick Syntax Reference: A Pocket Guide to the


Language, APIs, and Library 1st Edition Stefania Loredana
Nita
https://textbookfull.com/product/haskell-quick-syntax-reference-a-
pocket-guide-to-the-language-apis-and-library-1st-edition-stefania-
loredana-nita/
textbookfull.com
C# 7 Quick Syntax Reference: A Pocket Guide to the
Language, APIs, and Library 2nd Edition Mikael Olsson

https://textbookfull.com/product/c-7-quick-syntax-reference-a-pocket-
guide-to-the-language-apis-and-library-2nd-edition-mikael-olsson/

textbookfull.com

C++20 Quick Syntax Reference : a pocket guide to the


language, APIs, and library 4th Edition Mikael Olsson

https://textbookfull.com/product/c20-quick-syntax-reference-a-pocket-
guide-to-the-language-apis-and-library-4th-edition-mikael-olsson/

textbookfull.com

C++20 Quick Syntax Reference A Pocket Guide to the


Language, APIs, and Library. 4th Edition Mikael Olsson

https://textbookfull.com/product/c20-quick-syntax-reference-a-pocket-
guide-to-the-language-apis-and-library-4th-edition-mikael-olsson-2/

textbookfull.com

Java quick syntax reference Second Edition Olsson

https://textbookfull.com/product/java-quick-syntax-reference-second-
edition-olsson/

textbookfull.com

Java EE 6 Pocket Guide A Quick Reference for Simplified


Enterprise Java Development 1st Edition Gupta Arun

https://textbookfull.com/product/java-ee-6-pocket-guide-a-quick-
reference-for-simplified-enterprise-java-development-1st-edition-
gupta-arun/
textbookfull.com
Antonello Lobianco

Julia Quick Syntax Reference


A Pocket Guide for Data Science
Programming
Antonello Lobianco
Nancy, France

Any source code or other supplementary material referenced by the


author in this book is available to readers on GitHub via the book’s
product page, located at www.​apress.​com/​9781484251898 . For
more detailed information, please visit http://​www.​apress.​com/​
source-code .

ISBN 978-1-4842-5189-8 e-ISBN 978-1-4842-5190-4


https://doi.org/10.1007/978-1-4842-5190-4

© Antonello Lobianco 2019

This work is subject to copyright. All rights are reserved by the


Publisher, whether the whole or part of the material is concerned,
specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other
physical way, and transmission or information storage and retrieval,
electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.

Trademarked names, logos, and images may appear in this book.


Rather than use a trademark symbol with every occurrence of a
trademarked name, logo, or image we use the names, logos, and
images only in an editorial fashion and to the benefit of the
trademark owner, with no intention of infringement of the
trademark. The use in this publication of trade names, trademarks,
service marks, and similar terms, even if they are not identified as
such, is not to be taken as an expression of opinion as to whether or
not they are subject to proprietary rights.
While the advice and information in this book are believed to be true
and accurate at the date of publication, neither the authors nor the
editors nor the publisher can accept any legal responsibility for any
errors or omissions that may be made. The publisher makes no
warranty, express or implied, with respect to the material contained
herein.

Distributed to the book trade worldwide by Springer


Science+Business Media New York, 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505,
e-mail [email protected], or visit
www.springeronline.com. Apress Media, LLC is a California LLC and
the sole member (owner) is Springer Science + Business Media
Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware
corporation.
Introduction
This Julia quick syntax reference book covers the main syntax
elements of the Julia language as well as some of its more important
packages.
The first chapter explains the basic skills needed to set up the
software you need to run and develop Julia programs, including
managing Julia packages.
Chapter 2 presents the many predefined types (integers, strings,
arrays, etc.) and the methods to work with them. Memory and copy
issues are also presented in this chapter, together with an important
discussion about the implementation of the various concepts
ofmissingness .
After the basic data types have been introduced, Chapter 3 deals
with how to organize them in a sequence of logical statements to
compose your program. Control flow, functions, blocks, and scope
are all discussed in this chapter.
In Chapter 4 , we extend our discussion to custom types—in Julia,
both primitive and composite types can be custom-defined—and to
their organization in the program, either using inheritance or
composition. This chapter will be of particular use to readers
accustomed to other object-oriented programs, in order to see how
to apply object-oriented concepts in Julia.
Chapter 5 explains how to retrieve the inputs needed by your
program from a given source (the terminal, a text/CSV/Excel/JSON
file, or a remote resource) and conversely, to export the outputs of
your program.
In Chapter 6 , we discuss a peculiar feature of Julia, that is, the
possibility to manipulate the code itself after it has been parsed, but
before it is compiled and run. This paves the way to powerful macro
programming. We discuss it and present the concepts ofsymbols
andexpressions in Chapter 6 .
Julia is a relatively new language, and while the package ecosystem
is developing extremely rapidly (as most packages can be written
directly in the Julia language alone), it is highly likely that you will
still need libraries for which a direct port to Julia is not yet available.
Conversely, your main workflow may be in another, slower, high-level
language and you may want to use Julia to implement some
performant-critical tasks. Chapter 7 shows how to use C, C++,
Python, and R code and their relative libraries in Julia and,
conversely, embed Julia code in Python or R programs.
The following chapter (Chapter 8 ) gives a few recommendations for
writing efficient code, with runtime performances comparable to
compiled languages. We also deal here withprogrammer’s efficiency ,
discussing profiling and debugging tools and with a short
introduction to runtime exceptions.
This completes the discussion of thecore of the language. Julia,
however, has been designed as a thin language where most features
are provided by external packages, either shipped with Julia itself (a
sort of Julia Standard Library) or provided by third parties.
Therefore, the second part of the book deals with this Julia package
ecosystem. Chapter 9 introduces the main packages for working with
numerical data: storage with data structure packages
likeDataFrames andIndexedTables ; munging
withDataFramesMeta ,Query , andPipe ; and visualization with
thePlot package.
If Chapter 9 deals with processing numerical data, Chapter 10 deals
with mathematical libraries for more theoretical work.JuMP is an
acclaimed “algebraic modeling language” for numerical optimization
(and can be in itself the primary reason to learn about Julia). We
present two complete examples with linear and non-linear models.
The second model is then rewritten to be analytically resolved
withSymPy , which is a library for symbolic computation, e.g. the
analytical resolution of derivatives, integrals, and equations (and
systems of equations). Chapter 10 ends with a presentation
ofLsqFit , a powerful and versatile library to fit data. Finally,
Chapter 11 concludes the book with a series of tools that are of
more general use, like composing dynamic documents withWave ,
dealing with ZIP files withZipFile , and exposing a given Julia
model on the web withInteract andMux . Examples given in the
text are intentionally trivial. They are minimal working examples of
the syntax for the concepts they explain. If you are looking for
recipes directly applicable to your domain, a “cookbook” kind of book
may be more convenient.
While each package has been tested specifically with Julia 1.2 and
1.3-rc4, thanks to the Julia developers’ commitment to a stable API,
they should remain relevant for the entire 1.x series. Concerning
third-party packages, we report the exact version we tested our
code with. The section entitled “Using the Package Manager” in
Chapter 1 explains how to update a package to a given version if
subsequent versions of the package break the API.
Is such cases, please report the problem to us using the form at
https://julia-book.com . We will regularly publish updates
and errata on this site, where a discussion forum focused on the
book is also available.
Acknowledgments
This work has been supported by the French National Research
Agency through the Laboratory of Excellence, ARBRE, part of the
“Investissements d’Avenir” program (ANR 11 – LABX-0002-01).
I want to thank Germán González-Morris for his valuable help in
finding errors in the code and improving the description of the
language. I want to also thank Mark Powers, the Apress coordinating
editor, for his numerous “check ins” that pushed me to continue and
finish the book.
This has been possible thanks to the understanding and support of
my family.
Table of Contents
Part I: Language Core

Chapter 1:​Getting Started

1.​1 Why Julia?​

1.​2 Installing Julia

1.​3 Running Julia

1.​4 Miscellaneous Syntax Elements

1.​5 Packages

1.​5.​1 Using the Package Manager

1.​5.​2 Using Packages

1.​6 Help System

Chapter 2:​Data Types and Structures

2.​1 Simple Types (Non-Containers)

2.​1.​1 Basic Mathematic Operations

2.​1.​2 Strings

2.​2 Arrays (Lists)

2.​2.​1 Multidimensional​and Nested Arrays

2.​3 Tuples

2.​4 Named Tuples


2.​5 Dictionaries

2.​6 Sets

2.​7 Memory and Copy Issues

2.​8 Various Notes on Data Types

2.​8.​1 Random Numbers

2.​8.​2 Missing, Nothing, and NaN

Chapter 3:​Control Flow and Functions

3.​1 Code Block Structure and Variable Scope

3.​2 Repeated Iteration:​for and while Loops, List


Comprehension, Maps

3.​3 Conditional Statements:​if Blocks, Ternary Operator

3.​4 Functions

3.​4.​1 Arguments

3.​4.​2 Return Value

3.​4.​3 Multiple-Dispatch (aka Polymorphism)

3.​4.​4 Templates (Type Parameterization​)

3.​4.​5 Functions as Objects

3.​4.​6 Call by Reference/​Call by Value

3.​4.​7 Anonymous Functions (aka “Lambda” Functions)

3.​4.​8 Broadcasting Functions


3.​5 Do Blocks

3.​6 Exiting Julia

Chapter 4:​Custom Types

4.​1 Primitive Type Definition

4.​2 Structure Definition

4.​3 Object Initialization and Usage

4.​4 Abstract Types and Inheritance

4.​4.​1 Implementation of the Object-Oriented


Paradigm in Julia

4.​5 Some Useful Functions Related to Types

Chapter 5:​Input/​Output

5.​1 Reading (Input)

5.​1.​1 Reading from the Terminal

5.​1.​2 Reading from a File

5.​1.​3 Importing Data from Excel

5.​1.​4 Importing Data from JSON

5.​1.​5 Accessing Web Resources (HTTP)

5.​2 Writing (Output)

5.​2.​1 Writing to the Terminal

5.​2.​2 Writing to a File


5.​2.​3 Exporting to CSV

5.​2.​4 Exporting Data to Excel

5.​2.​5 Exporting Data to JSON

5.​3 Other Specialized IO

Chapter 6:​Metaprogramming and Macros

6.​1 Symbols

6.​2 Expressions

6.​2.​1 Creating Expressions

6.​2.​2 Evaluating Symbols and Expressions

6.​3 Macros

6.​3.​1 Macro Definition

6.​3.​2 Macro Invocation

6.​3.​3 String Macros

Chapter 7:​Interfacing Julia with Other Languages

7.​1 Julia ⇄ C

7.​2 Julia ⇄ C++

7.​2.​1 Interactive C++ Prompt

7.​2.​2 Embed C++ Code in a Julia Program

7.​2.​3 Load a C++ Library


7.​3 Julia ⇄ Python

7.​3.​1 Embed Python Code in a Julia Program

7.​3.​2 Use Python Libraries

7.​3.​3 PyJulia:​Using Julia in Python

7.​4 Julia ⇄ R

7.​4.​1 Interactive R Prompt

7.​4.​2 Embed R Code in a Julia Program

7.​4.​3 Use R Libraries

7.​4.​4 JuliaCall:​Using Julia in R

Chapter 8:​Effectively Write Efficient Code

8.​1 Performance

8.​1.​1 Benchmarking

8.​1.​2 Profiling

8.​1.​3 Type Stability

8.​1.​4 Other Tips to Improve Performance

8.​2 Code Parallelization

8.​2.​1 Adding and Removing Processes

8.​2.​2 Running Heavy Computations on a List of Items

8.​2.​3 Aggregate Results

8.​3 Debugging
8.​3.​1 Introspection Tools

8.​3.​2 Debugging Tools

8.​4 Managing Runtime Errors (Exceptions)

Part II: Packages Ecosystem

Chapter 9:​Working with Data

9.​1 Using the DataFrames Package

9.​1.​1 Installing and Importing the Library

9.​1.​2 Creating a DataFrame or Loading Data

9.​1.​3 Getting Insights About the Data

9.​1.​4 Filtering Data (Selecting or Querying Data)

9.​1.​5 Editing Data

9.​1.​6 Editing Structure

9.​1.​7 Managing Missing Values

9.​1.​8 The Split-Apply-Combine Strategy

9.​1.​9 Pivoting Data

9.​1.​10 Dataframe Export

9.​2 Using IndexedTables

9.​2.​1 Creating an IndexedTable (NDSparse)

9.​2.​2 Row Filtering

9.​2.​3 Editing/​Adding Values


9.​3 Using the Pipe Operator

9.​4 Plotting

9.​4.​1 Installation and Backends

9.​4.​2 The Plot Function

9.​4.​3 Plotting from DataFrames

9.​4.​4 Saving

Chapter 10:​Mathematical Libraries

10.​1 JuMP, an Optimization Framework

10.​1.​1 The Transport Problem:​A Linear Problem

10.​1.​2 Choosing Between Pizzas and Sandwiches, a


Non-Linear Problem

10.​2 SymPy, a CAS System

10.​2.​1 Loading the Library and Declaring Symbols

10.​2.​2 Creating and Manipulating Expressions

10.​2.​3 Solving a System of Equations

10.​2.​4 Retrieving Numerical Values

10.​3 LsqFit, a Data Fit Library

10.​3.​1 Loading the Libraries and Defining the Model

10.​3.​2 Parameters

10.​3.​3 Fitting the Model


10.​3.​4 Retrieving the Parameters and Comparing them
with the Observations

Chapter 11:​Utilities

11.​1 Weave for Dynamic Documents

11.​2 Zip Files

11.​2.​1 Writing a Zip Archive

11.​2.​2 Reading from a Zipped Archive

11.​3 Interact and Mux:​Expose Interacting Models on the


Web

11.​3.​1 Importing the Libraries

11.​3.​2 Defining the Logic of the Model

11.​3.​3 Defining Controls and Layout

11.​3.​4 Providing Widgets to Web Users

Index
About the Author and About the
Technical Reviewer
About the Author
Antonello Lobianco, PhD
is a research engineer employed by a French Grande école
(Polytechnic University). He works on biophysical and economic
modeling of the forest sector and is responsible for the Lab Models
portfolio. He uses C++, Perl, PHP, Python, and Julia. He teaches
environmental and forest economics at the undergraduate and
graduate levels and modeling at the PhD level. He has been
following the development of Julia as it fits his modeling needs, and
he is the author of several Julia packages (search for sylvaticus on
GitHub for more information).

About the Technical Reviewer


Germán González-Morris

is a polyglot software architect/engineer with 20+ years in the field.


He has knowledge of Java (EE), Spring, Haskell, C, Python, and
JavaScript, among others. He works with web distributed
applications. Germán loves math puzzles (including reading Knuth)
and swimming. He has tech reviewed several books, including an
application container book (Weblogic), as well as titles covering
various programming languages (Haskell, TypeScript, WebAssembly,
Math for Coders, and RegExp, for example). You can find more
information on his blog ( https://devwebcl.blogspot.com/ )
or Twitter account(@devwebcl) .
Part I
Language Core
© Antonello Lobianco 2019
Antonello Lobianco, Julia Quick Syntax Reference, https://doi.org/10.1007/978-1-
4842-5190-4_1

1. Getting Started
Antonello Lobianco1
(1) Nancy, France

1.1 Why Julia?


With so many programming languages available, why create yet
another one? Why invest the time to learn Julia? Is it worth it?
One of the main arguments in favor of using Julia is that it
contributes to improving a trade-off that has long existed in
programming—fast coding versus fast execution.
On the one side, Julia allows the developer to code in a dynamic,
high-level language similar to Python, R, or MATLAB, interacting with
the code and having powerful expressivity (see Chapter 6, for
example).
On the other side, with minimum effort, developers can write
programs in Julia that run (almost) as fast as programs written in C
or FORTRAN.
Wouldn’t it be better, though, to optimize existing languages, with
their large number of libraries and established ecosystems, rather
than create a new language from scratch?
Well, yes and no. Attempts to improve runtime execution of dynamic
languages are numerous. PyPy (https://pypy.org), Cython
(https://cython.org), and Numba
(https://numba.pydata.org) are three notable examples for
the Python programming language. They all clash with one fact:
Python (and, in general, all the current dynamic languages) was
designed before the recent development of just-in-time (JIT)
compilers, and hence it offers features that are not easy to optimize.
The optimization tools either fail or require complex workarounds in
order to work.
Conversely, Julia has been designed from the ground up to work
with JIT compilers, and the language features—and their internal
implementations—have been carefully considered in order to provide
the programmer with the expected productivity of a modern
language, all while respecting the constraints of the compiler. The
result is that Julia-compliant code is guaranteed to work with the
underlying JIT compiler, producing in the end highly optimized
compiled code.

The Shadow Costs of Using a New Language

If it is true that the main “costs” of using a new language relate


to learning the language and having to abandon useful libraries
and comfortable, feature-rich development editors that you are
accustomed to, it is also true that in the Julia case these costs are
mitigated by several factors:
The language has been designed to syntactically resemble
mainstream languages (you’ll see it in this book!). If you
already know a programming language, chances are you will
be at ease with the Julia syntax.
Julia allows you to easily interface your code with all the
major programming languages (see Chapter 7, “Interfacing
Julia with Other Languages”), hence reusing their huge sets
of libraries (when these are not already ported to Julia).
The development environments that are available—e.g., Juno
(https://junolab.org), IJulia Jupiter kernel
(https://github.com/JuliaLang/IJulia.jl), and
VSCode Julia plugin
(https://github.com/JuliaEditorSupport/julia-
vscode)—are frankly quite cool, with many common
features already implemented. They allow you to be
productive in Julia from the first time you code with it.

Apart from the breakout in runtime performances from traditional


high-level dynamic languages, the fact that Julia was created from
scratch means it uses the best, most modern technologies, without
concerns over maintaining compatibility with existing code or
internal architectures. Some of the features of Julia that you will
likely appreciate include built-in Git-based package manager, full
code introspection, multiple dispatches, in-core high-level methods
for parallel computing, and Unicode characters in variable names
(e.g., Greek letters).
Thanks to its computational advantages, Julia has its natural roots in
the domain of scientific, high-performance programming, but it is
becoming more and more mature as a general purpose
programming language. This is why this book does not focus
specifically on the mathematical domain, but instead develops a
broad set of simple, elementary examples that are accessible even
to beginner programmers.

1.2 Installing Julia


Julia code can be run by installing the Julia binaries for your system
available in the download section
(http://julialang.org/downloads/) of the Julia Project
website (https://julialang.org).
The binaries ship with a Julia interpreter console (aka, the “REPL”—
Read, Eval, Print, Loop), where you can run Julia code in a
command-line fashion.
For a better experience, check out an Integrated Development
Environment, for example, Juno (http://junolab.org/) an IDE
based on the Atom (https://atom.io) text editor, or IJulia
(https://github.com/JuliaLang/IJulia.jl), the Julia
Jupiter (http://jupyter.org/) backend.
Detailed setup instructions can be found on their respective sites,
but in a nutshell, the steps are pretty straightforward.
For Juno:
Install the main Julia binaries first.
Download, install, and open the Atom text editor
(https://atom.io).
From within Atom, go to the Settings ➤ Install panel.
Type uber-juno into the search box and press Enter. Click
the Install button on the package with the same name.
For IJulia:
Install the main Julia binaries first.
Install the Python-based Jupyter Notebook server using the
favorite tools of your OS (e.g., the Package Manager in
Linux, the Python spip package manager, or the Anaconda
distribution).
From a Julia console, type using Pkg;
Pkg.update();Pkg.add("IJulia");Pkg.build("IJ
ulia").
The IJulia kernel is now installed. Just start the notebook
server and access it using a browser.
You can also choose, at least to start with, not to install Julia at all,
and try instead one of the online computing environments that
support Julia. For example, JuliaBox (https://juliabox.com/),
CoCalc (https://cocalc.com/doc/software-julia.html),
Nextjournal (https://nextjournal.com), and Binder
(https://mybinder.org).
Some tricks for Juno and IJulia

Juno can:
Enable block selection mode with .

Run a selection of code by selecting it and either


selecting Run Block or typing on
Windows and Linux or on Mac.

Comment/uncomment a block of code with


(Windows and Linux) or (Mac) .

IJulia:
Check out the many keyboard shortcuts available from
Help ➤ Keyboard Shortcuts.
Need to run Julia in a computational environment for a
team or a class? Use JupyterHub
(https://github.com/jupyterhub/jupyterhub),
the multi-user solution based on Jupyter.

1.3 Running Julia


There are many ways to run Julia code, depending on your needs:
1. Julia can run interactively in a console. Start julia to obtain
the REPL console, and then type the commands there (type
exit() or use CTRL+D when you are finished).

2. Create a script, i.e. a text file ending in .jl, and let Julia parse
and run it with julia myscript.jl [arg1,
arg2,..].Script files can also be run from within the Julia
console. Just type include("myscript.jl").
3. In Linux or on MacOS, you can instead add at the top of the
script the location of the Julia interpreter on your system,
preceded by #! and followed by an empty row, e.g.
#!/usr/bin/julia (You can find the full path of the Julia
interpreter by typing which julia in a console.). Be sure that
the file is executable (e.g., chmod +x myscript.jl).
You can then run the script with ./myscript.jl.

4. Use an Integrated Development Environment (such as those


mentioned), open a Julia script, and use the run command
specific to the editor.

You can define a global (for all users of the computer) and local (for
a single user) Julia file that will be executed at any startup, where
you can for example define functions or variables that should always
be available. The location of these two files is as follows:
Global Julia startup file:
[JULIA_INSTALL_FOLDER]\etc\julia\startup.jl
(where JULIA_INSTALL_FOLDER is where Julia is installed)
Local Julia startup file:
[USER_HOME_FOLDER]\.julia\config\startup.jl
(where USER_HOME_FOLDER is the home folder of the local
user, e.g. %HOMEPATH% in Windows and ~ in Linux)
Remember to use the path with forward slashes ( / ) with Linux.
Note that the local config folder may not exist. In that case, just
create the config folder as a .julia subfolder and start the new
startup.jl file there.

Julia keeps all the objects created within the same work
session in memory. You may sometimes want to free memory or
“clean up” your session by deleting no longer needed objects. If
you want to do this, just restart the Julia session (you may want
to use the trick mentioned at the end of Chapter 3) or use the
Revise.jl (https://github.com/timholy/Revise.jl)
package for finer control.

You can determine which version of Julia you are using with the
versioninfo() option (within a Julia session).

1.4 Miscellaneous Syntax Elements


Julia supports single-line ( # ) and multi-line ( #= [...] =# )
comments. Multi-line comments can be nested and appear anywhere
in the line:

println("Some code..") JULIA


#=
Multiline comment
#= nested multiline comment =#
Still a comment
=#
println(#= A comment in the middle of the line =#
"This is a code") # Normal single-line comment

You don’t need to use semicolons to indicate the end of a statement.


If they’re used, semicolons will suppress the command output (this
is done automatically in scripting mode). If the semicolon is used
alone in the REPL, it allows you to switch to the OS command shell
prompt in order to launch a system-wide command.
Blocks don’t need to be surrounded by parentheses, but they do
require the keyword end at the close.
While indentation doesn’t carry any functional meaning in the
language, empty spaces sometimes are important. For example,
function calls must uses parentheses with the inputs strictly
attached to the function name, e.g.:

println (x) # rise an ERROR TEXT

println(x) # OK

In Julia, variable names can include a subset of Unicode symbols,


allowing a variable to be represented, for example, by a Greek letter.
In most Julia development environments (including the console), to
type a Greek letter, you use a LaTeX-like syntax. This involves typing
\, then the LaTeX name for the symbol (e.g. \alpha for α), and
then pressing Tab to confirm. Using LaTeX syntax, you can also add
subscripts, superscripts, and decorators.
, α, y1,
All the following are valid, if not crazy, variable names: x1, x̃
y(a+b), y2, , and .
Note, however, that while you can use y2 as a variable name, you
can’t use 2y, as the latter is automatically interpreted as 2 * y.
Together with Unicode, this greatly simplifies the transposition in
computer code of mathematical equations.
If you come from a language that follows a zero-indexing standard
(such as C or Python), one important point to remember is that Julia
arrays are one-based indexed (counting starts from 1 and not 0).
There are ways to override this behavior, but in many cases doing so
probably would do more harm than good.

1.5 Packages
Julia developers have chosen an approach where the core of Julia is
relatively light, and additional functionality is usually provided by
external “packages”.
Julia binaries ship with a set of these packages (think to it as a
“Standard Library”) and a powerful package manager that is able to
download (typically directly from GitHub repositories), pre-compile,
update, and solve dependencies, all with a few simple commands.
While registered packages can be installed simply by using their
name, unregistered packages need their source location to be
specified. At the time of this writing, over 2,400 registered packages
have been published.
Knowing how packages work is essential to efficiently working in
Julia, and this is why I have chosen to introduce package
management early in the book and complement the book with a
discussion of some common packages.

1.5.1 Using the Package Manager


There are two ways to access package management features,
interactively and as an API from within other Julia code:
The interactive way is to type ] in the REPL console to enter a
“special” pkg mode. The prompt will then change from julia>
to (vX.Y) pkg>, where vX.Y is the current Julia version.
You can then run any package manager commands or go back
to the normal interpreter mode with BACKSPACE.
The API way is to import the pkg module into your code
(using Pkg) and then run Pkg.command(ARGS). Obviously,
nothing inhibits you from using the API approach in an
interactive session, but the special package mode has tab
completion and other goodies that make it more comfortable to
use.
Note that the two interfaces are not 100% consistent, with the
API interface being slightly more stringent.
Some of the useful package commands are explained in the
following list:
status: Retrieves a list (name and version) of the locally
installed packages.
update: Updates the local index of packages and all the local
packages to the latest version.
add pkgName: Automatically downloads and installs a given
package. For multiple packages use add Pkg1 Pkg2 or
Pkg.add(["Pkg1","Pkg2"]).
add pkgName#master, add pkgName#branchName, or add
pkgName#vX.Y.Z: Checks out the master branch of a given
package, a specific branch, or a specific release, respectively.
free pkgName: Returns the package to the latest release.
rm pkgName: Removes a package and all its dependent
packages that have been installed automatically only for it.
add [email protected]:userName/pkgName.jl.git:
Checks out a non-registered package from a Git repository
(here, it’s GitHub).

1.5.2 Using Packages


To access the functionalities of a package, you need to either use or
import it. The difference is as follows:
Using a package allows you to access the package functions
directly. Just include a using mypackage statement in the
console or at the beginning of the script.
Importing a package does the same, but helps in keeping the
namespace clean, as you need then to refer to the package
functions using their full names, as myPkg.myFunction. You
can use aliases or choose to import only a subset of functions
(that you can then access directly).
For example, to access the function plot(), which is available in
the package Plots, you can do the following (see the “Plotting”
Discovering Diverse Content Through
Random Scribd Documents
“You will stay to dinner,” he said, presently.
“If you will excuse me to-day——” began Tom.
“But I won’t excuse you, sir. Why on earth should I?” he
answered, with a flash of his old irritability. “The old house is not
good enough for you, I suppose, now you know it holds nothing but
paupers.”
“Thank you, sir: I will stay to dinner,” said Tom, quietly.
“It will be a charity to Jenny, too,” added the Squire. “She’s been
moped up indoors, without a soul to speak to, for I don’t know how
long. And it’s more than a month since she heard from young Cope
—his letters must have miscarried, you know—and I’m afraid that’s
preying on her mind; and so you had better keep her company to-
day.”
Tom needed no further pressing, we may be sure. He smiled
grimly to himself at the idea of Edward Cope’s long silence being a
matter of distress to Jane. He rose to go.
“Just ring that bell, will you?” said the Squire. “And sit down again
for another minute or two. There’s something I wanted to say to
you, but I can’t call to mind what it is just now.”
Jane answered the bell in person. She gave Tom her hand in
silence, but there was a world of meaning in her eyes as she did so.
“My dear, I wish you would see whether Ridley is anywhere about,
and send word that I want to see him. What do you think the villain
has done?”
“I don’t know, I’m sure, papa.”
“Why, he’s planted a lot of white hyacinths along with the purple
ones in your poor mother’s favourite bed opposite the dressing-room
window, when he knows very well that I never have any but purple
ones there. She never had any but purple ones, and I never will. The
scoundrel deserves to be well horsewhipped. I’ll discharge him on
the spot I swear I will!”
“I will tell him to come and see you,” said Jane, calmly. She knew
of old that her father’s bark was worse than his bite, and that he had
no more real intention of discharging Ridley than he had of flying to
the moon.
“And now, if you will just give orders to have the basket-carriage
brought round, I shall be glad, dear. I feel wonderfully better to-day,
and I think a drive would do me good.”
“But would Dr. Davidson approve of your going out to-day, papa?”
“Hang Dr. Davidson I’m not his slave, am I? I tell you that I feel
very much better; and, to get out, if only for half an hour, will make
me better still.”
“Then you will let me go with you?” said Jane.
“Nothing of the kind. I’ve a great deal to think about while I’m
out, and I want to be alone. Besides, I’ve asked Bristow to stay to
dinner, and you must do your best to entertain him.”
“If you go out, papa, I shall go with you,” said Jane, in her
straightforward, positive way. “Besides which, Briggs is ill to-day, and
there’s nobody to drive you—unless you will let Mr. Bristow be your
coachman for once, and then we shall all be together.”
With some difficulty the Squire was induced to consent to this
arrangement. It was evident that he would have preferred to go out
alone, but that was just what Jane would by no means allow him to
do. Her woman’s instinct told her that they were in the midst of a
thunder-cloud, but where and when the lightning would strike she
could not even guess. In any case, it seemed to her well that for
some time to come her father should be left alone as little as
possible.
So they drove out together, all three of them. The Squire was
unusually silent, but did not otherwise seem different from his
ordinary mood, and neither Tom nor Jane was much inclined for
talking. On the road they found a child of six, a little girl who had
wandered away from home and lost herself, who was sitting by the
roadside crying bitterly. The Squire would have the child on his knee,
although she was neither very neatly dressed nor very pretty. He
kissed her, and soothed away her tears, and made her laugh, and
found out where she lived. Then, in a little while, still sitting on his
knee, she fell asleep, and the old man wrapped the thickest rug
around her, and sheltered her from the cold as tenderly as though
she had been his own child. And when the girl’s mother was found,
and the girl herself had to be given up, he made her kiss him, and
put half-a-crown into her hand, and promised to call and see her in a
day or two. Tom, watching him narrowly all the time, said to himself,
“I don’t understand him at all to-day. I thought my news would have
overwhelmed him, but it seems to have had far less effect upon him
than it had upon me. I’m fairly puzzled.” But there are some troubles
so overwhelming that, for a time at least, they numb and deaden
the feelings by their very intensity. All the more painful is the after-
waking.
“I think, dear, that I will go and lie down for a little while,” said the
Squire, when they had reached home. “You will wake me up in time
for dinner.”
But there was Blenkinsop, his steward, waiting by appointment,
who wanted his signature to the renewal of a lease.
“Yes, yes, to be sure, Blenkinsop,” said he Squire, in his old
business-like way, as he sat down at his writing-table and spread out
the paper before him and dipped his pen in the ink. Then he paused.
“Just your name, sir, nothing more—on that line,” said the
steward, deferentially, marking the place with his finger.
“Just so, Blenkinsop, just so,” said the Squire, tremulously. “But
what is my name? Just for the moment I don’t seem as if I could
recollect it.”
A look of horror flashed from Jane’s eyes into the eyes of Tom.
She was by her father’s side in a moment. He looked helplessly up at
her, and tried to smile, but his lips quivered and tears stood in his
eyes.
“What is it, dear?” she said, as she stooped and pressed her lips
to his forehead.
“I want to sign this lease, and for the life of me I can’t recollect
my own name.”
“Titus Culpepper, dear,” she whispered in his ear.
“Of course. What an idiot I must be!” he exclaimed with a laugh,
as he dashed off the name in his usual rapid style, and ended with a
bigger flourish than usual.
“Won’t you go to bed, papa?” said Jane, insinuatingly, as soon as
Blenkinsop was gone. “You will rest so much better there, you
know.”
“Go to bed at this time of day, indeed! What are you thinking
about? No, I’ll just have a little snooze on the sofa—nothing more.
And be sure you wake me up in time for dinner.”
In less than two minutes he had gone off to sleep, as calmly and
quietly as any little child. Jane rejoined Tom in the drawing-room.
“I am afraid that papa has heard some very bad news, Mr.
Bristow,” she said.
“Yes, and I was the unfortunate bearer of it,” answered Tom.
“He sent you to London the other day to make certain private
inquiries for him?”
“He did.”
“And the ill news you brought this morning is the result of those
inquiries?”
“It is.”
There was a pause, which Tom was the first to break. “I think it
only right, Miss Culpepper,” he said, “that you should be made
acquainted with the nature of the business which took me to
London. You have no brother, and I know that you have had the
practical management of many of your father’s affairs for a long
time. It is only right that you should know.”
“But I would rather not know, Mr. Bristow, if you think that papa
would prefer, in the slightest degree, that I should not be told.”
“I think it highly desirable that you should be told,” said Tom. “No
doubt Mr. Culpepper himself will tell you everything before long.”
“I am not so sure on that point,” interrupted Jane. “As regards his
pecuniary affairs, I know little or nothing, although I have long had
my suspicions that there was something wrong somewhere.”
“In such a matter as this there should be nothing hidden from you
—at least not now; and I will take on myself the responsibility of
telling you all that I know. Should Mr. Culpepper himself tell you
subsequently, there will be no harm done, while you will have had
time to think the affair over, and will be better able to advise him as
to what ought to be done under the circumstances. Should he not
choose to tell you, I still maintain that it will be better, both for
himself and for you, that you should rest in ignorance no longer.”
Tom then told her all about his visit to London, its object, and its
result.
“Thank heaven that it’s nothing more serious than the loss of a
few thousand pounds!” said Jane, with an air of relief, when Tom
had done. “Papa will soon get over that, and we shall be as happy
again as ever we have been.”
“I am by no means certain that Mr. Culpepper will get over it as
easily as you imagine,” said Tom, gravely. “I suspect that the entire
savings of many years have gone in this crash; and that alone, to a
man of your father’s time of life, is something very serious indeed.”
“Don’t think, Mr. Bristow, that I want to make too light of the loss,”
said Jane, earnestly. “Still, after all, it is nothing but money.”
Her spirits had risen wonderfully during the last few minutes, and
she could not help showing it. “Dinner will be ready in half an hour,”
she added. “I will go and see whether papa is awake.”
Presently she came back. “He is still fast asleep,” she said.
“I think I would not disturb him if I were you,” said Tom. “Sleep,
just now, is his best medicine.”
As the Squire still slept on, they dined alone, and alone they spent
the evening together. They talked of a thousand things, and they
seemed to have a thousand more to talk about when the time for
parting had come. This evening Tom seemed to care no longer about
hiding his feelings. He sat nearer to Jane, he bent more closely over
her at the piano; once or twice his lips seemed to touch her hair
lightly, but she was not quite sure on the point, and consequently
did not care to reprove him. His eyes sought hers more persistently
and boldly than they had ever done before, and beneath those
ardent glances her own eyes fell, troubled and confused.
When it was time to go, Jane went with him to the door. Said
Tom, as he stood on the threshold, hat in hand, “Should Mr.
Culpepper speak to you about what I have told you this evening,
and should he seem at all troubled in his mind about it, will you
kindly suggest that he should send for me? It may seem rather
conceited on my part to ask you to do this, but as your father has
honoured me by taking me into his confidence so far, there can be
no harm in my expressing a hope that he will do so still further. It
may be in my power to help him through his difficulties or, at least,
through part of them.”
“You are very kind,” said Jane, with tears in her eyes, as she
pressed his hand, gratefully.
“And now—good-night,” said Tom.
Still holding her hand, he looked earnestly into her face. They
were standing together just under the hall lamp, and every shade of
expression was plainly visible. Her eyes met his for a moment. He
read something there—I know not what—that emboldened him. His
arm stole round her waist. He pressed her unresisting form to his
heart. His lips touched hers for one brief instant. It was the first kiss
of love. “Good-night, my darling,” he whispered; and almost before
Jane knew what had befallen her, he was gone.
Her father being still asleep, Jane, all in a sweet confusion, took
her work upstairs, and sat down by the dressing-room fire to wait till
he should awake. But he still slept on, and by-and-by it grew late, so
she sent the servants to bed, and made up her mind to sit by his
side till morning. Just then nothing could have been more grateful to
her. No thought of sleep would be possible to her for hours to come.
She wanted to think over the events of that wonderful evening—to
think over them in silence and alone. The time to analyze her
feelings had not yet come: she did not care to make the attempt:
she only wanted to realize quietly to herself the one sweet blissful
fact, that she was loved, and by the one person in the whole world
to whom her own love could be given in return. What happy
thoughts nestled round her young heart in the midnight quietude of
the old house! “He loves me!” she whispered to herself. But the
night wind, listening at the window, caught the syllables and
whispered them back, and then rushed gleefully away to tell the
trees and the flowers, that began already to feel the warmth of
spring in their veins, and the little birds sleeping cosily in their nests
beneath the winter moon, and Jane’s secret was a secret no longer.
It was nearly three o’clock when the Squire woke up from his long
sleep. It was a minute or two before he could collect his thoughts,
and call to mind all that had happened.
“You are no better than a little simpleton for sitting up,” he said,
gruffly. “As if I couldn’t take care of myself when I awoke!” Then he
drew her on to his knee and kissed her tenderly. “Get me some
bread and cheese and ale,” he said. “I’ll have supper and breakfast
in one.”
“Won’t you have something different from bread and cheese,
papa?” she asked. “There is some game pie and——”
“No, nothing but bread and cheese,” he said, gloomily. “That
seems about the only thing I shall be able to afford in time to come.”
So Jane went down into the lower part of the house, and brought
up some bread and cheese and ale; but she brought some game pie
also, and when she put a plateful of the latter article before her
father, he ate it without a word, and without seeming to know what
it was he was eating. He did not speak another word till he had
done.
“Jenny, you are a clever girl,” he said abruptly, at last, “but do you
think you are clever enough to earn your own living?”
Jane laughed. “Your question is rather a strange one,” she said. “I
will answer it as a woman answers most questions—by asking
another. Why do you ask me?”
“Because if I were to die to-morrow, or next month, or next year,
that is certainly what you would have to do.”
“And I don’t doubt my ability to do it,” said Jane, with spirit. “Only,
papa, you are not going to die either next month, or next year, so
that the subject is one which we need not discuss further.”
“But it is a subject that must be discussed, and discussed very
fully, too. Jane, my girl, you are a pauper, neither more nor less than
a pauper!” He spoke in a dry harsh voice, as if he had made up his
mind that his emotion should on no account over-master him.
“Well, papa dear, even if such be the case, I don’t suppose that
either you or I will love each other any the less on that account.”
“That is not the question, girl. It was always a happiness to me to
know that I should be able to give you fifteen or twenty thousand on
your wedding day. In trying to turn that fifteen into fifty thousand, I
have lost every penny of it, and in so doing I have altogether ruined
your prospects in life.”
“I can’t see that at all, papa. What you did you did for the best,
and if I ever do get married, I hope to marry some one who will love
me for myself, and not for any money I might be possessed of.”
“Very pretty, and very sentimental,” said the Squire, gruffly, “but
confounded rubbish for all that. And how hard on young Cope! He
will be quite justified in breaking off the engagement.”
“What a splendid opportunity Mr. Cope will now have for proving
the sincerity of his affection!” said Jane, with a little contemptuous
curl of the lip.
“You are talking rank nonsense, Janet. Edward Cope loves you;
there’s no doubt of that; but his father will never consent to his
marrying a beggar, which is just about what you are at the present
moment; and Edward has been too well brought up to go in
opposition to his father. I confess it will be a great disappointment to
me.”
“But none to me, papa dear!” cried Jane, impulsively, as she flung
her arms round her father’s neck and kissed him—“no
disappointment to me! Rather let us call it a happy release.”
“I don’t understand you,” said the old man, as he took her by the
shoulders and gazed into her face. “I thought you loved Edward
Cope as much as he loved you. You don’t mean to tell me that I
have been mistaken.”
“There has been a mistake somewhere, papa,” faltered Jane, as
she drew one of his arms round her neck, and nestled her head on
his shoulder. “I—I almost fancy that it must have been on my side. I
allowed myself to drift into an engagement with Mr. Cope almost
without knowing what I was about. I liked Mr. Cope very well, and I
thought that I could be happy as his wife, but I have found out my
mistake since then. For me to marry Mr. Cope would be to condemn
myself to a life of hopeless misery. I could never love him, papa, as
a wife ought to love her husband.”
“Tut—tut—tut, girl! What romantic rubbish have you got into your
head? Cope’s a nice young fellow, and when you were his wife you
would soon learn to love him well enough, I warrant. All I’m afraid of
is that he won’t have you for a wife—and all through my fault—all
through my fault!”
Jane saw that the present was no time to say more on the point,
and wisely held her tongue. For a little while the silence between
them was unbroken.
“But I haven’t told you the worst yet, Jenny,” he said at last.
“Oh! papa.”
“Five thousand pounds of your Aunt Fanny’s money has been lost
in the crash. She had entrusted me with the money to do the best I
could for her, and that’s the result. She will be at Pincote in less than
a week from now, and the first thing she will do, after she has taken
off her bonnet and changed her boots, will be to ask me for her
money. She will ask me for her money, and what am I to say to
her?”
“Good gracious, papa! Aunt Fanny is your own sister, and surely
she, of all people in the world, would be the last to trouble you for
her money.”
“She would be the first,” said the Squire, fiercely. “I’d sooner, far
sooner, be indebted to the veriest stranger than to her. You don’t
know your aunt as I know her. I should never hear the last of it. I
should have no peace of my life. Day and night my turpitude—my
vile criminality, as she would call it—would be dinned into my ears,
till I should be driven half crazy. And not only that: your Aunt Fanny
is a woman who can never keep a secret. To one confidential friend
after another the whole affair would be whispered, with sundry
embellishments of her own, till at last the whole country side would
know of it, and I could never hold up my head in society again.”
“As I understand the case, papa, you want to raise five thousand
pounds within the next few days?”
“That is precisely what I want.”
“Then why not ask Mr. Cope? Surely he would not refuse to lend it
to you.”
“I am not so sure about that,” said Mr. Culpepper, dryly. “Cope has
not been like the same man to me of late that he used to be. The
old ship is beginning to leak, and the rats are deserting it. I suppose
I shall be compelled to ask him, but I would almost sooner lose my
right hand than do it.”
“There’s Mr. Bristow,” suggested Jane, timidly. “Why not speak to
him? He might, perhaps, find some means of helping you out of your
difficulty.”
“How can a man that’s not worth five thousand pence be of any
use to a man who wants five thousand pounds?” asked the Squire,
contemptuously. “No, no; Bristow’s all very well in his way. A decent,
good-natured young fellow, with all his wits about him, but of no use
whatever at a crisis like the present.”
“Is there not such a thing as a mortgage?” asked Jane. “Could you
not raise some money on the estate?”
“When my father lay on his deathbed,” said the Squire, gravely,
“he made me take a solemn oath that I would never raise a penny
by mortgage on the estate, and I would rather suffer anything and
everything than break that promise. But it’s high time we were both
in bed. You look worn-out for want of sleep, and I don’t feel over
bright myself. Kiss me, dearie, and let us say good-night, or rather
good-morning. We must hope for the best, and at present that
seems the only thing we can do.”
The following post brought a letter from Mrs. McDermott. After
mentioning on what day and by what train she might be expected to
arrive, she wrote: “You won’t forget the five thousand pounds,
brother. I have bought some house property, and want to remit the
money immediately on my arrival. I suppose it would not be
reasonable to expect more than five per cent. interest on the
amount?” The Squire tossed the letter across the table to Jane
without a word.

END OF VOL. II.

BILLING, PRINTER, GUILDFORD, SURREY


*** END OF THE PROJECT GUTENBERG EBOOK IN THE DEAD OF
NIGHT: A NOVEL. VOLUME 2 (OF 3) ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like