Get Haskell The Ultimate Beginner s Guide to Learn Haskell Programming Step by Step 1st Edition Claudia Alves PDF ebook with Full Chapters Now

Download as pdf or txt
Download as pdf or txt
You are on page 1of 62

Download the full version of the textbook now at textbookfull.

com

Haskell The Ultimate Beginner s Guide to


Learn Haskell Programming Step by Step 1st
Edition Claudia Alves

https://textbookfull.com/product/haskell-the-
ultimate-beginner-s-guide-to-learn-haskell-
programming-step-by-step-1st-edition-claudia-
alves/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Lua Programming The Ultimate Beginner s Guide to Learn Lua


Step by Step 3rd Edition Claudia Alves

https://textbookfull.com/product/lua-programming-the-ultimate-
beginner-s-guide-to-learn-lua-step-by-step-3rd-edition-claudia-alves/

textbookfull.com

The Ultimate Beginner s Guide to Learn kotlin Programming


Step by Step 2020 2nd Edition Moaml Mohmmed

https://textbookfull.com/product/the-ultimate-beginner-s-guide-to-
learn-kotlin-programming-step-by-step-2020-2nd-edition-moaml-mohmmed/

textbookfull.com

Go programming language The Ultimate Beginner s Guide to


Learn Go Programming Step by Step 3rd Edition John Bach

https://textbookfull.com/product/go-programming-language-the-ultimate-
beginner-s-guide-to-learn-go-programming-step-by-step-3rd-edition-
john-bach/
textbookfull.com

Urban Storm Water Management Second Edition Pazwash

https://textbookfull.com/product/urban-storm-water-management-second-
edition-pazwash/

textbookfull.com
Thomas S Szasz The Man and His Ideas 1st Edition Jeffrey
A. Schaler

https://textbookfull.com/product/thomas-s-szasz-the-man-and-his-
ideas-1st-edition-jeffrey-a-schaler/

textbookfull.com

Marketing research 7th Edition Alvin Burns

https://textbookfull.com/product/marketing-research-7th-edition-alvin-
burns/

textbookfull.com

LPI Linux Essentials Study Guide Exam 010 v1 6 3rd Edition


Christine Bresnahan

https://textbookfull.com/product/lpi-linux-essentials-study-guide-
exam-010-v1-6-3rd-edition-christine-bresnahan/

textbookfull.com

Growing Up and Out of Crime: Desistance, Maturation, and


Emerging Adulthood 1st Edition Elias S. Nader

https://textbookfull.com/product/growing-up-and-out-of-crime-
desistance-maturation-and-emerging-adulthood-1st-edition-elias-s-
nader-2/
textbookfull.com

Television Field Production and Reporting: A Guide to


Visual Storytelling 7th Edition Fred Shook

https://textbookfull.com/product/television-field-production-and-
reporting-a-guide-to-visual-storytelling-7th-edition-fred-shook/

textbookfull.com
Window on Humanity: A Concise Introduction to General
Anthropology Conrad Kottak

https://textbookfull.com/product/window-on-humanity-a-concise-
introduction-to-general-anthropology-conrad-kottak/

textbookfull.com
Haskell
The Ultimate Beginner's Guide to Learn Haskell Programming Step by Step

1st edition
2020

By Claudia Alves
"Programming isn't about what you know; it's
about what you can figure out.” - Chris Pine
memlnc

INTRODUCTION
WHAT MAKES HASKELL SPECIAL?
HOW IS HASKELL USED?
WHAT DO YOU NEED TO START
STARTING
READY, SET, GO!
THE FIRST SMALL FUNCTIONS
AN INTRODUCTION TO THE LISTS
TEXAS RANGES
I'M AN INTENSIONAL LIST
TUPLES
CHAPTER I
TYPES AND TYPE CLASSES
BELIEVE IN THE TYPE
TYPE VARIABLES
TYPE CLASSES STEP BY STEP (1ST PART)
CHAPTER II
THE SYNTAX OF FUNCTIONS
PATTERN ADJUSTMENT
GUARDIANS, GUARDIANS!
WHERE?
LET IT BE
CASE EXPRESSIONS
CHAPTER III
RECURSION
HELLO RECURSION!
THE IMPRESSIVE MAXIMUM
A FEW MORE RECURSIVE FUNCTIONS
QUICKSORT!
THINKING RECURSIVELY
CHAPTER IV
HIGHER ORDER FUNCTIONS
CURRIFIED FUNCTIONS
HIGHER ORDER IN YOUR ORDER
ASSOCIATIONS AND FILTERS
LAMBDAS
FOLDS AND ORIGAMI
APPLICATION OF FUNCTIONS WITH $
COMPOSITION OF FUNCTIONS
CHAPTER V
MODULES
LOADING MODULES
DATA.LIST
DATA.CHAR
DATA.MAP
DATA.SET
CREATING OUR OWN MODULES
CHAPTER VI
CREATING OUR OWN TYPES AND TYPE
CLASSES
INTRODUCTION TO ALGEBRAIC DATA TYPES
REGISTRATION SYNTAX
TYPE PARAMETERS
DERIVED INSTANCES
TYPE SYNONYMS
RECURSIVE DATA STRUCTURES
TYPE CLASSES STEP BY STEP (2ND PART)
THE YES-NO TYPE CLASS
THE FUNCTOR TYPE CLASS
FAMILIES AND MARTIAL ARTS
CHAPTER VII
INPUT AND OUTPUT
HELLO WORLD!
FILES AND DATA STREAMS
COMMAND LINE PARAMETERS
RANDOMNESS
BYTE STRINGS
EXCEPTIONS
Introduction
A balance of flexible and inflexible qualities make Haskell a fascinating
programming language to learn and use.

First, the Haskell programming language is not named after Eddie Haskell,
the sneaky double-dealing neighbor kid in the ancient TV sitcom, Leave It To
Beaver.

Haskell is named after Haskell Brooks Curry, an American mathematician


and logician. If you don't know, logicians create models to describe and
define human reasoning, for example, problems in mathematics, computer
science, and philosophy. Haskell’s main work was in combinatory logic, a
notation designed to eliminate the need for variables in mathematical logic.
Combinatory logic captures many key features of computation and, as a
result, is useful in computer science. Haskell has three programming
languages named after him: Haskell, Brooks, and Curry.

Haskell the language is built around functions, useful blocks of code that do
specific tasks. They are called and used only when needed.

Another interesting feature of functional languages like Haskell: functions are


treated as values like integers (numbers) and strings. You can add a function
to another function the way you can add an integer to an integer, 1 + 1 or 35
+ 53. Perhaps the best way to describe this quality is a spreadsheet: in a cell
in the spreadsheet, you can add numbers as well as a combination of
functions to work on numbers. For example, you might specify each number
in cells 1-10 be added up as a sum. In Excel, at least, you also can use
SUMIF to look for a pattern in cells 1-10 and, if the pattern is found, perform
an action on any cells with the pattern.
What Makes Haskell Special?
Technically, Haskell is a general-purpose functional programming language
with non-strict semantics and strong static typing. The primary control
construct is the function. (Say that fast ten times!) Here's what it means:

- Every language has a strategy to evaluate when to process the input


arguments used in a call to a function. The simplest strategy is to evaluate the
input arguments passed then run the function with the arguments. Non-strict
semantics means the input arguments are not evaluated unless the arguments
passed into the function are used to evaluate what is in the body of the
function.

- Programming languages have rules to assign properties — called a type


— to the components of the language: variables, functions, expressions, and
modules. A type is a general description of possible values the variable,
function, expression, or module can store. Typing helps minimize bugs, for
example, when a calculation uses a string ("house” or "cat”) instead of a
number (2 or 3). Strong static typing evaluates the code before runtime, when
the code is static and possibly as code is written.

- The order in which statements, instructions and functions are evaluated


and executed determines the results of any piece of code. Control constructs
define the order of evaluation. Constructs use an initial keyword to flag the
type of control structure used. Initial keywords might be "if” or "do” or
"loop” while final keywords might be "end if” or "enddo” or "end loop”.
Instead of a final keyword, Haskell uses indentation level (tabs) or curly
brackets, or a mix, to indicate the end of a control structure.

Perhaps what makes Haskell special is how coders have to think when they
use the language. Functional programming languages work in very different
ways than imperative languages where the coder manages many low-level
details of what happens in their code and when. While it is true all languages
have things in common, it’s also true languages are mostly functional or
mostly imperative, the way people are mostly right handed or left handed.
Except functional programming languages require a different way of thinking
about software as you code.

Other features that make Haskell interesting:

- Strong data typing (evaluating properties of all inputs into a function)


is combined with polymorphism; a function to sort numbers also can be
used to sort strings of text. In some languages, you would have to code
two or more functions, one for each data type.

- Lazy evaluation (one of my favorite coding terms!) allows the result of


one function/task to be handed to another function/task on the same line
of code. For example, the command can search a file for all instances of a
string then pass the results to be printed to the computer screen.
Functions that can take other functions as arguments or return them as
results also are called higher order functions.

- No side effects. In other languages, code can affect the state of the
computer and application, for example, writing to a file. Haskell strictly
limits these side effects which, in turn, makes Haskell applications less
prone to errors.

- Haskell uses monads, a structure that works like an assembly line


where every stop on the line performs a different task. This allows
Haskell to separate side effects as a distinct activity apart from any
function, for example, logging any errors as a function performs tasks on
its data inputs.

Building from small bits of code, each bit tightly contained and testable.

How is Haskell Used?


Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
As a functional programming language, Haskell has benefits like shorter
development time, cleaner code, and high reliability. The tight control of side
effects also eliminates many unforeseen interactions within a code base.
These features are especially of interest to companies who must build
software with high fault tolerances, for example, defense industries, finance,
telecommunications, and aerospace.

However, Haskell also is used in web startups where functional programming


might work better than imperative programming. Apparently Facebook,
Google, NVIDIA, and other companies use Haskell to build internal tools
used in their software development and IT environments. Even a lawn mower
manufacturer in Kansas uses Haskell to build and distribute their mowers.
And the New York Times recently used Haskell to build an image processing
tool for the 2013 New York Fashion week.

So what is Haskell?

Haskell is a purely functional programming language . In imperative


languages we obtain results by giving the computer a sequence of tasks that it
will then execute. While running them, you can change state. For example,
we set the variable to 5, perform some tasks, and then change the value of the
previous variable. These languages have flow control structures to carry out
certain actions several times ( for , while ...). With purely functional
programming we do not tell the computer what it has to do, but rather, we say
how things are. The factorial of a number is the product of all the numbers
from 1 to that number, the sum of a list of numbers is the first number plus
the sum of the rest of the list, etc. We express the form of the functions. Also
we can't set a variable to something and then set it to something else. If we
say that a is 5, then we cannot say that it is something else because we have
just said that it is 5. Are we liars? Thus, in purely functional languages, a
function has no side effects. The only thing a function can do is calculate and
return something as a result. At first this may seem like a limitation but in
reality it has some good consequences: if a function is called twice with the
same parameters, we will always get the same result. We call this referential
transparency and it not only allows the compiler to reason about the behavior
of a program, but it also allows us to easily deduce (and even demonstrate)
that a function is correct and thus be able to build more complex functions by
joining simple functions.

Haskell is lazy . That is, unless we tell you otherwise, Haskell will not
execute functions or calculate results until you are really forced to. This
works very well in conjunction with referential transparency and allows us to
view programs as a series of data transformations. It even allows us to do
cool things like infinite data structures. Let's say we have a list of immutable
numbers xs = [1,2,3,4,5,6,7,8] and a doubleMe function that multiplies each item
by 2 and returns a new list. If we wanted to multiply our list by 8 in an
imperative language if we did doubleMe (doubleMe (doubleMe (xs))) , the computer
would probably loop through the list, make a copy and return the value. Then
it would go through the list two more times and return the final value. In lazy
language, calling doubleMe with an unforced list to display the value ends up
with a program telling you "Sure, sure, then I'll do it!". But when you want to
see the result, the first doubleMe tells the second one that he wants the result,
now! The second says the same to the third and the latter reluctantly returns a
duplicate 1, which is a 2. The second receives it and returns a 4 to the first.
The first one sees the result and says that the first item in the list is an 8. In
this way, the computer only makes a journey through the list and only when
we need it. When we want to calculate something from initial data in lazy
language, we just have to take this data and transform and mold it until it
resembles the result we want.

Haskell is a statically typed language . When we compile a program, the


compiler knows which pieces of the code are integers, which are text strings,
etc. Thanks to this a lot of possible errors are caught at compile time. If we
try to add a number and a text string, the compiler will scold us. Haskell uses
a fantastic type system that has type inference. This means that we don't have
to explicitly tag each piece of code with a type because the type system can
intelligently deduce it . Type inference also allows our code to be more
general, if we have created a function that takes two numbers and adds them
together and we do not explicitly set their types, the function will accept any
pair of parameters that act as numbers.
Haskell is elegant and concise. It is because it uses high-level concepts.
Haskell programs are typically shorter than the imperative equivalents. And
short programs are easier to maintain than long ones, and they have fewer
errors.
Haskell was created by some very smart guys (all of them with their
respective doctorates). The project to create Haskell began in 1987 when a
committee of researchers agreed to design a revolutionary language. In 2003
the Haskell report was published, thus defining a stable version of the
language.

What do you need to start


A Haskell text editor and compiler. You probably already have your favorite
text editor installed so we're not going to waste your time on this. Right now,
Haskell's two main compilers are GHC (Glasgow Haskell Compiler) and
Hugs. For the purposes of this guide we will use GHC. I will not cover many
details of the installation. In Windows it is a matter of downloading the
installer, pressing "next" a few times and then restarting the computer. In
Debian-based Linux distributions it can be installed with apt-get or by
installing a deb package . In MacOS it is a matter of installing a dmg or using
macports . Whatever your platform, here is more information.
GHC takes a script from Haskell (they usually have the .hs extension ) and
compiles it, but it also has an interactive mode which allows us to interact
with these scripts. We can call the functions of the scripts that we have
loaded and the results will be shown immediately. It is much easier and faster
to learn instead of having to compile and run the programs over and over
again. Interactive mode is executed by typing ghci from your terminal. If we
have defined some functions in a file called, say, myFunctions.hs , we can load
those functions by typing : l myFunctions , as long as myFunctions.hs is in the
same directory where ghci was invoked . If we modify the .hs script and want
to observe the changes we have to rerun : l myFunctions or run : r which is
equivalent since it reloads the current script. We will work defining some
functions in a .hs file , we load them and spend time playing with them, then
we will modify the .hs file by reloading it and so on. We will follow this
process throughout the guide.

Starting
Ready, Set, Go!

Alright, let's get started! If you are that kind of bad person who doesn't read
the introductions and you have skipped it, you may want to read the last
section of the introduction because it explains what you need to follow this
guide and how we are going to work. The first thing we are going to do is run
GHC in interactive mode and use some functions to get used to it a little.
Open a terminal and type ghci . You will be greeted with a greeting like this:
GHCi, version 7.2.1: http://www.haskell.org/ghc/:? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude>
Congratulations, you came from GHCi! Here the pointer (or prompt ) is
Prelude> but since it gets longer as we load modules during a session, we are
going to use ghci> . If you want to have the same pointer execute : set prompt
"ghci> " .
Here we have some simple arithmetic.
ghci> 2 + 15
17
ghci> 49 * 100
4900
ghci> 1892 - 1472
420
ghci> 5/2
2.5
ghci>
It is self explanatory. We can also use several operations on the same line so
that all the rules of precedence that we all know are followed. We can use
parentheses to use explicit precedence.
ghci> (50 * 100) - 4999
one
ghci> 50 * 100 - 4999
one
ghci> 50 * (100 - 4999)
-244950
Very interesting, huh? Yes, I know not, but be patient. A small difficulty to
keep in mind occurs when we deny numbers, it will always be better to
surround negative numbers with parentheses. Doing something like 5 * -3
will make GHCi angry, however 5 * (-3) will work.
Boolean algebra is also quite simple. As you probably know, && represents
the logical AND while || represents the logical OR . not denies True to False
and vice versa.
ghci> True && False
False
ghci> True && True
True
ghci> False || True
True
ghci> not False
True
ghci> not (True && True)
False
The equality check is done like this:
ghci> 5 == 5
True
ghci> 1 == 0
False
ghci> 5 / = 5
False
ghci> 5 / = 4
True
ghci> "hello" == "hello"
True
What if we do something like 5 + "text" or 5 == True ? Well, if we try the
first one we get this friendly error message:
No instance for (Num [Char])
arising from a use of `+ 'at <interactive>: 1: 0-9
Possible fix: add an instance declaration for (Num [Char])
In the expression: 5 + "text"
In the definition of `it ': it = 5 +" text "
GHCi is telling us that "text" is not a number and therefore does not know
how to add it to 5. Even if instead of "text" it were "four" , "four" , or "4" ,
Haskell would not consider it as a number. + expects its left and right sides to
be numbers. If we try to perform True == 5 , GHCi would tell us that the
types do not match. While + works only with things that are considered
numbers, == works with anything that can be compared. The trick is that both
must be comparable to each other. We can't compare speed with bacon. We'll
take a more detailed look at the types later. Note: we can do 5 + 4.0 because 5
does not have a specific type and can act as an integer or as a floating point
number. 4.0 cannot act as an integer, so 5 is the only one that can be adapted.
You may not know it, but we have been using functions all this time. For
example, * is a function that takes two numbers and multiplies them. As you
have already seen, we call him making a sandwich on him. We call this infix
functions. Many functions that are not used with numbers are prefixes. Let's
see some of them.

Functions are normally prefixes so from now on we are not going to say that
a function is in prefix form, we will just assume it. In many imperative
languages functions are called by writing their names and then writing their
parameters in parentheses, usually separated by commas. In Haskell,
functions are called by typing their name, a space, and their parameters,
separated by spaces. For starters, let's try calling one of Haskell's most boring
functions.
ghci> succ 8
9
The succ function takes anything that has a successor defined and returns that
successor. As you can see, we have simply separated the function name and
its parameter by a space. Calling a function with multiple parameters is just
as easy. The min and max functions take two things that can be put in order
(like numbers!) And return one of them.
ghci> min 9 10
9
ghci> min 3.4 3.2
3.2
ghci> max 100 101
101
The application of functions (calling a function by putting a space after it and
then writing its parameters) has the highest priority. Said with an example,
these two sentences are equivalent:

ghci> succ 9 + max 5 4 + 1


16
ghci> (succ 9) + (max 5 4) + 1
16

However, if we had wanted to obtain the successor of the product of the


numbers 9 and 10, we could not have written succ 9 * 10 because we would
have obtained the successor of 9, which would have been multiplied by 10,
obtaining 100. We have to write succ ( 9 * 10) to get 91.
If a function takes two parameters we can also call it as an infix function by
surrounding it with open accents. For example, the div function takes two
integers and performs an integer division between them. Doing div 92 10
would get 9. But when we call it that, there may be some confusion as to
what number is doing the division and which is being divided. So we call it
as an infix function making 92 `div` 10 , thus making it clearer.
People who already know some imperative language tend to cling to the idea
that parentheses indicate an application of functions. For example, in C, you
use parentheses to call functions like foo () , bar (1) , or baz (3, "haha") . As
we have said, spaces are used to apply functions in Haskell. So these
functions in Haskell would be foo , bar 1 and baz 3 "haha" . If you see
something like bar (bar 3) it does not mean that bar is called with bar and 3 as
parameters. It means that we first call the function bar with 3 as a parameter
to get a number, and then call bar again with that number. In C, this would be
something like bar (bar (3)) .

The first small functions


In the previous section we got a basic idea of how to call the functions. Now
let's try to make ours! Open your favorite text editor and paste this function
that takes a number and multiplies it by two.
doubleMe x = x + x
Functions are defined similarly to what they are called. The function name is
followed by the parameters separated by spaces. But, when we are defining
functions, there is an = and then we define what the function does. Save this
as baby.hs or as you like. Now navigate to where you saved it and run ghci
from there. Once inside GHCi, write : l baby . Now that our code is loaded,
we can play with the function that we have defined.
ghci>: l baby
[1 of 1] Compiling Main (baby.hs, interpreted)
Ok, modules loaded: Main.
ghci> doubleMe 9
18
ghci> doubleMe 8.3
16.6
Since + works with integers just as well as with floating-point numbers
(actually anything that can be considered a number), our function also works
with any number. We are going to make a function that takes two numbers,
multiplies each of them by two and then adds both.
doubleUs x y = x * 2 + y * 2
Simple. We could also have defined it as doubleUs x y = x + x + y + y . Both
forms produce very predictable results (remember to add this function in the
baby.hs file , save it and then execute : l baby inside GHCi).
ghci> doubleUs 4 9
26
ghci> doubleUs 2.3 34.2
73.0
ghci> doubleUs 28 88 + doubleMe 123
478
As you can deduce, you can call your own functions within the functions you
do. With this in mind, we could redefine doubleUs as:
doubleUs x y = doubleMe x + doubleMe y
This is a simple example of a normal pattern that you will see throughout
Haskell. Create small functions that are obviously correct and then combine
them into more complex functions. In this way you will also avoid repeating
yourself. What if some mathematicians discover that 2 is actually 3 and you
have to change your program? You can simply redefine doubleMe to be x + x
+ x and how doubleUs calls doubleMe will automatically work in this strange
world where 2 is 3.
Functions in Haskell don't have to be in any particular order, so it doesn't
matter if you define doubleMe first and then doubleUs or do it the other way
around.
Now we are going to create a function that multiplies a number by 2 but only
if that number is less than or equal to 100, because the numbers greater than
100 are already large enough on their own.

doubleSmallNumber x = if x > 100


then x
else x * 2

We have just introduced the Haskell if statement . You are probably already
familiar with the if statement from other languages. The difference between
Haskell's if statement and that of imperative languages is that the else part is
mandatory. In imperative languages we can skip a few steps if a condition is
not satisfied, but in Haskell each expression or function must return a value.
We could also have defined the if statement on a single line but it seems a bit
more readable that way. Another thing about the if statement in Haskell is
that it is an expression. Basically an expression is a piece of code that returns
a value. 5 is an expression because it returns 5, 4 + 8 is an expression, x + y is
an expression because it returns the sum of x and y . Since the else part is
mandatory, an if statement will always return something and is therefore an
expression. If we want to add one to each number that is produced by the
previous function, we can write its body like this.
doubleSmallNumber ' x = ( if x > 100 then x else x * 2 ) + 1
If we had omitted the parentheses, I would have only added one if x was not
greater than 100. Look at the ' at the end of the function name. That
apostrophe has no special meaning in Haskell's syntax. It is a valid character
to be used in the name of a function. We usually use ' to denote the strict
version of a function (one that is not lazy) or a small modified version of a
function or variable. Since ' is a valid character for functions, we can do
things like this.
conanO'Brien = "It's me, Conan O'Brien!"
There are two things that remain to be highlighted. The first is that the name
of this function does not begin with capital letters. This is because functions
cannot start with an uppercase letter. We will see why a little later. The
second is that this function does not take any parameters, we usually call it a
definition (or a name). Since we can't change definitions (and functions) after
we've defined them, conanO'Brien and the string "It's a-me, Conan O'Brien!"
they can be used interchangeably.
An introduction to the lists

Like real-life shopping lists, lists in Haskell are very helpful. It is the most
widely used data structure and can be used in different ways to model and
solve a lot of problems. The lists are VERY important. In this section we will
take a look at the basics about lists, text strings (which are lists) and
intensional lists.
In Haskell, lists are a homogeneous data structure . Stores multiple items of
the same type. This means that we can create an integer list or a character list,
but we cannot create a list that has a few integers and a few other characters.
And now, a list!
Note
We can use the let keyword to define a name in GHCi. Doing let a = 1 inside
GHCi is equivalent to writing a = 1 to a file and then loading it.
ghci> let lostNumbers = [4,8,15,16,23,42]
ghci> lostNumbers
[4,8,15,16,23,42]

As you can see, the lists are defined by square brackets and their values are
separated by commas. If we tried to create a list like this [1,2, 'a', 3, 'b', 'c', 4] ,
Haskell would warn us that the characters (which by the way are declared as
a character in single quotes) are not numbers. Speaking of characters, strings
are simply lists of characters. "hello" is just a syntactic alternative to ['h', 'e',
'l', 'l', 'o'] . Since the strings are lists, we can use the functions that operate
with lists on them, which is really useful.
A common task is to concatenate two lists. Which we did with the ++
operator .

ghci> [1,2,3,4] ++ [9,10,11,12]


[1,2,3,4,9,10,11,12]
ghci> "hello" ++ "" ++ "world"
hello world
ghci> ['w', 'o'] ++ ['o', 't']
woot

Be careful when using the ++ operator repeatedly on long strings. When we


Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
concatenate two lists (even if we add a list of one item to another list, for
example [1,2,3] ++ [4] , internally Haskell has to loop through the entire list
from the left side of the ++ operator . This is not a problem when working
with lists that are not too big. But concatenating something at the end of a list
that has fifty million elements will take a while. However, concatenating
something at the beginning of a list using the operator : (also called operator
cons) is instantaneous.

ghci> 'U': "n black cat"


"A black cat"
ghci> 5: [1,2,3,4,5]
[5,1,2,3,4,5]
Notice that : it takes a number and a list of numbers or a character and a list
of characters, while ++ takes two lists. Even if you add an item to the end of
the lists with ++ , you have to surround it with square brackets so that it
becomes a single item list.
ghci> [1,2] ++ 3
<interactive>: 1: 10:
No instance for (Num [a0])
arising from the literal `3 '
[...]
ghci> [1,2] ++ [3]
[1,2,3]

[1,2,3] is a 1: 2: 3 syntactic alternative : [] . [] is an empty list. 3 If we put it


with : we obtain [3] , and if we put 2 to get this [2,3] .
Note
[] , [[]] and [[], [], []] are different things from each other. The first is an
empty list, the second is a list containing one item (an empty list), and the
third is a list containing three items (three empty lists).
If we want to get an item from the list knowing its index, we use !! . Indexes
start with 0.
ghci> "Steve Buscemi" !! 6
'B'
ghci> [9.4,33.2,96.2,11.2,23.25] !! one
33.2

But if we try to get the sixth item in a list that only has four items, we will get
an error, so be careful.
Lists can also contain lists. These can also contain lists that contain lists, that
contain lists ...

ghci> let b = [[1,2,3,4], [5,3,3,3], [1,2,2,3,4], [1,2,3]]


ghci> b
[[1,2,3,4], [5,3,3,3], [1,2,2,3,4], [1,2,3]]
ghci> b ++ [[1,1,1,1]]
[[1,2,3,4], [5,3,3,3], [1,2,2,3,4], [1,2,3], [1,1,1,1] ]
ghci> [6,6,6]: b
[[6,6,6], [1,2,3,4], [5,3,3,3], [1,2,2,3,4], [1,2,3]]
ghci> b !! two
[1,2,2,3,4]

The lists within the lists can have different sizes but cannot have different
types. In the same way that you cannot contain characters and numbers in a
list, you cannot contain lists that contain character lists and number lists
either.
The lists can be compared if the elements they contain can be compared.
When we use < , <= , > , and > = to compare lists, they are compared in
lexicographic order. The heads are first compared. Then the second elements
are compared and so on.
What else can we do with the lists? Here are some basic functions that can
operate with lists.
head takes a list and returns its head. The head of a list is basically the first element.
ghci> head [5,4,3,2,1]
5
tail takes a list and returns its tail. In other words, cut off the head of the list.
ghci> tail [5,4,3,2,1]
[4,3,2,1]
last takes a list and returns its last element.
ghci> last [5,4,3,2,1]
one
init takes a list and returns the entire list except its last element.
ghci> init [5,4,3,2,1]
[5,4,3,2]

If we imagine the lists as monsters, they would be something like:

But what if we try to get the head of an empty list?


ghci> head []
*** Exception: Prelude.head: empty list
Oh we broke it! If there is no monster, there is no head. When we use head ,
tail , last and init we must be careful not to use empty lists with them. This
error cannot be caught at compile time so it is always a good practice to take
precautions before telling Haskell to return you some items from an empty
list.

length takes a list and obviously returns its size.


ghci> length [5,4,3,2,1]
5
null checks if a list is empty. If it is, it returns True , otherwise it returns False . Use this
function instead of xs == [] (if you have a list called xs).
ghci> null [1,2,3]
False
ghci> null []
True
reverse reverses a list.
ghci> reverse [5,4,3,2,1]
[1,2,3,4,5]
take takes a number and a list and extracts said number of elements from a list. Observe.
ghci> take 3 [5,4,3,2,1]
[5,4,3]
ghci> take 1 [3,9,3]
[3]
ghci> take 5 [1,2]
[1,2]
ghci> take 0 [6,6,6]
[]

Note that if we try to take more elements than there are in a list, it
simply returns the list. If we take 0 elements, we get an empty list.
drop works similarly, except that it removes a number of items from the beginning of the
list.
ghci> drop 3 [8,4,2,1,5,6]
[1,5,6]
ghci> drop 0 [1,2,3,4]
[1,2,3,4]
ghci> drop 100 [1,2,3,4]
[]
maximum takes a list of things that can be put in some sort of order and returns the
largest element.
minimum returns the smallest.
ghci> minimum [8,4,2,1,5,6]
one
ghci> maximum [1,9,2,3,4]
9
sum takes a list of numbers and returns their sum.
product takes a list of numbers and returns your product.
ghci> sum [5,2,1,6,3,2,5,7]
31
ghci> product [6,2,1,2]
24
ghci> product [1,2,5,6,7,9,2,0]
0
elem takes a thing and a list of things and tells us if that thing is an element of the list.
This function is normally called infixed because it is easier to read.
ghci> 4 `elem` [3,4,5,6]
True
ghci> 10 `elem` [3,4,5,6]
False

These were a few basic functions that operate with lists. We will see more
functions that operate with lists later.

Texas ranges

What if we want a list with all the numbers between 1 and 20? Yes, we could
just write them all but obviously this is not a solution for those who are
looking for good programming languages. Instead, we will use ranges.
Ranges are a way to create lists that contain an arithmetic sequence of
enumerable elements. The numbers can be numbered. One, two, three, four,
etc. Characters can also be numbered. The alphabet is an enumeration of
characters from A to Z. The names are not enumerable. What comes after
"Juan"? No idea.
To create a list containing all the natural numbers from 1 to 20 we simply
write [1..20] . It is equivalent to writing
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] and there is no
difference between typing one or the other except that manually typing a long
sequence of enumerables is pretty stupid.

ghci> [1..20]
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
ghci> ['a' .. 'z']
"ABCDEFGHIJKLMNOPQRSTU VWXYZ"
ghci> ['K' .. 'Z']
"KLMNOPQRSTUVWXYZ"

We can also specify the number of steps between elements of a range. What
if we want all the even numbers from 1 to 20? Or every third number?
ghci> [2,4..20]
[2,4,6,8,10,12,14,16,18,20]
ghci> [3,6..20]
[3,6,9,12,15,18]
It is a matter of separating the first two elements with a comma and then
specifying the upper limit. Although they are smart, the step ranges are not as
smart as some people expect them to be. You cannot type [1,2,4,8,16..100]
and expect to get all powers of 2. First because only one step can be
specified. And second, because the sequences that are not arithmetic are
ambiguous if we only give a few initial elements.
To get a list with all the numbers from 20 to 1 we cannot use [20..1] , we
must use [20,19..1] .
Be careful when using floating point numbers with ranges! These are not
entirely accurate (by definition), and their use with ranges may give some
unexpected results.
ghci> [0.1, 0.3 .. 1]
[0.1.0.3.0.5.0.7.0.8999999999999999.1.0999999999999999]

My advice is not to use ranges with floating point numbers.


We can also use ranges to create infinite lists simply by not indicating an
upper limit. Later we will focus more on the infinite lists. For now, let's
examine how we would get the first 24 multiples of 13. Yes, we can use
[13,26..24 * 13] . But there is a better way: take 13 [13,26 ..] . Since Haskell
is lazy, he won't try to evaluate the infinite list immediately because it would
never end. It will wait to see what you want to get from the infinite list. In
this case he sees that we only want the first 24 elements and he evaluates
them with pleasure.
Now, a couple of functions that generate infinite lists:
cycle takes a list and creates an infinite cycle of equal lists. If we tried to display the
result it would never end so you have to cut it somewhere.
ghci> take 10 (cycle [1,2,3])
[1,2,3,1,2,3,1,2,3,1]
Random documents with unrelated
content Scribd suggests to you:
threatened with shot-guns. To discover this Arthur kept a sharp look-
out for signs by the roadside.
It was surprising, now that he began to look for them, and to
discover for himself where to look, how many he found. There was
hardly a dwelling along the way but what had the character of its
inmates denoted by rude chalk marks on some conspicuous object in
its immediate vicinity. So by applying only at the houses whose signs
were favorable, they got along very nicely for three days. They were
allowed to sleep in comfortable barns each night, and had several
meals given to them without charge, though they always offered to
pay for what they received. Thus, on the fourth day, when they
expected to reach Washington, they had spent but one dollar of their
little store.
As neither of them was used to walking, and as to Uncle Phin’s
rheumatic stiffness of limb was now added a severe pain in the knee
that had been injured by falling on the platform at Arden, their
progress was very slow. It was so slow, in fact, that Arthur began to
despair of ever completing their long journey on foot, and to wonder
if no other means of travel could be found.
He was so busily thinking over the several plans that proposed
themselves, on the evening of that fourth day, that he hardly paid any
attention to the great white dome of the Capitol at Washington that,
looming high above the city, marked the end of this stage of their
journey. Nor did he pay much attention to the black clouds gathering
overhead, until Uncle Phin, who was hobbling painfully along beside
him, said: “We’se er gwine hab a storm, Honey, an I spec hits comin
down rambumptious.” As he spoke there came a wild gust of wind
accompanied by a flurry of rain.
They were on such a lonely stretch of road that there was no house
in sight, and only a haystack in a neighboring field offered the
slightest shelter. So they hurried to it, and burrowing under its
leeward side, found there comparative protection from the storm,
which they hoped would be of short duration.
But it lasted all night, with the wind shifting and blowing from
every quarter; so that, after long hours of sleepless misery, the gray
dawn found them soaked to the skin by the pitiless rain, faint with
hunger, and shivering with cold.
With the first daylight they tried to move on in search of a house;
but when poor Uncle Phin attempted to rise from his cramped
position, he sank back with a groan. His injured knee had swollen
and stiffened during the night, so that every effort to move it now
gave him excruciating pain. He was entirely helpless; and the twelve-
year-old boy, upon whom this new responsibility had so suddenly
fallen, was, for a few moments, overwhelmed by it. Then he rallied
bravely, and, saying, “I am going for help, Uncle Phin, but I’ll be back
just as quick as I can,” he started on a run across the sodden field,
toward the road.
In less than half an hour he returned with a team that he had
discovered on its way to the city. Its driver agreed to take them as far
as he went for two dollars, which sum Arthur gladly promised him.
He would have given everything he possessed, and even willingly
have resigned his prospects of finding a home, for the sake of getting
his dear old friend to some shelter in which he could have warmth
and food.
With great difficulty they got Uncle Phin into the wagon, where he
lay with his head in Arthur’s lap. Two hours later they were
established in an humble negro boarding-house, to which the driver
of the wagon had taken them. Here they could have a small but neat
and well-warmed room for a dollar a week, payable in advance.
Procuring a cup of hot tea and some broth for Uncle Phin, besides
food for himself and Rusty, completely exhausted Arthur’s slender
stock of money. So, when he had got Uncle Phin to bed, and seen
that he was as comfortable as possible, the brave, tired little fellow
started out into the strange city to try and earn some more.
That day he made twenty-five cents, by holding a horse for several
hours, while its rider was attending to some business in one of the
public buildings. Then, for several days, his fortunes fluctuated; on
one of them he made a whole dollar by running errands, holding
horses, carrying parcels for ladies who were shopping, and by doing,
cheerfully and faithfully, from morning to night, everything that
offered, no matter how hard or disagreeable it was. On other days he
made nothing.
At length a piece of good fortune befell him. The holiday season
was drawing near, and the business of the retail stores was greatly
increased. The proprietor of one of them, who had noticed this
cheerful little errand-boy waiting for odd jobs in front of his store,
finally offered him regular work, for a few weeks, at fifty cents a day.
For this he was always to be on hand to open the doors of carriages,
carry parcels for shoppers to the horse-cars, and make himself
generally useful outside the store.
In the meantime, poor Uncle Phin, stricken with rheumatic fever,
lay suffering and groaning in his bed through the long, lonely days of
several weeks, before he was again able to hobble about.
During these weeks of toil, suffering, and anxiety, little Rusty was
Arthur’s constant companion and sole comforter, and the boy grew
to love him better than anything on earth, except Uncle Phin. In
going to and fro from his work each day, he passed a certain house,
in which lived a gentleman who was very fond of dogs. This
gentleman noticed Rusty, and took such a fancy to him that he
several times offered to buy him. Arthur steadily refused these offers,
until at length, when Christmas was past, and there was no more
work for him at the store. Then he went to the gentleman’s house,
and trying to speak bravely, but with quivering lips and tear-filled
eyes, told him he might have the dear little dog for two tickets to
Richmond.
Uncle Phin was again able to travel, and intensely anxious to
continue their journey, so as to reach his old home “befo de dawn ob
de New Yeah.” Arthur’s travels had taught him that railroad tickets
cost money; but with all his efforts and self-denials, he had been
unable to save anything from his scanty earnings. So, for Uncle
Phin’s sake, he finally decided to sacrifice his dear Rusty, if by so
doing he could obtain the means of getting to Richmond.
The gentleman gladly, and without asking any questions, accepted
this strange offer, and sent a servant to procure the required tickets.
Then the poor little fellow, after giving Rusty a long parting hug, ran
home, with a heavy heart, and a suspicious moisture glistening in his
eyes.
The next day they travelled in the cars to Richmond, and the mere
knowledge that he was once more in old Virginia, seemed to infuse
new life into Uncle Phin. Without a moment’s delay, they started to
walk the ten miles of rough, frozen road that lay between the city and
Dalecourt.
The old man’s strength lasted wonderfully, but it gave out when
they were still two miles from their destination; and, tottering to the
doorway of a dilapidated and deserted cabin, that stood on the
roadside, he declared that he could go no farther, and begged his boy
companion to go on without him.
To this Arthur would not listen for a moment; but, helping the old
man into the cabin, he declared they could rest there very
comfortably until morning. Then he gathered a quantity of sticks,
broken branches, and small logs, which he piled in the big fireplace
that filled one end of the cabin’s single room. He had just one match,
but it did its duty, and soon a cheerful blaze was roaring up the old
earthen chimney.
Grateful for its warmth, and for even this poor shelter, they
prepared to pass, as best they might in this lonely place, the last
night of the old year. There were no doors or windows to the cabin,
so that everything they did might be plainly seen by any chance
passers along that wintry road.
Arthur still had his book of fairy tales; and, as darkness set in, the
old man begged him to read “jes one lilly story” from it, to help them
forget their wretchedness. So, sitting in the brightest glow of the
firelight, the boy bent his brave, careworn young face over the pages,
and read the touching story of “The Little Match-Girl.”
Her situation and theirs were so much alike, that the story seemed
very real to him; and as he started at the sound of a rustle behind
him just as he closed the book, he looked up, almost expecting to see
some beautiful vision. Nor was he disappointed. A dainty, richly-clad
figure stood in the doorway. As the boy lifted his eyes he uttered a cry
of mingled fear, amazement, and joy. The face into which he was
looking was that of the beautiful lady who had given him this
precious book, and who had written in it “To Prince Dusty, from his
Fairy Godmother.”
THE FAIRY GODMOTHER
FINDS PRINCE DUSTY.
(Page 198.)
CHAPTER XXV.
FINDING A HOME.

B efore Arthur could recover in the slightest from his


bewilderment at this wonderful and undreamed-of appearance
of his beautiful lady in such a place, she stepped forward and caught
him in her arms. “Oh, my little Prince Dusty! My dear little Prince
Dusty!” she cried. “Where have you been? How did you get here? Do
you know that I am your cousin? Your own cousin, Harriet Dale, and
that I live at Dalecourt? I never was so utterly amazed in my life as I
am to find you here! We knew that you had left the Dustins; but
nobody could tell where, or how, you had gone. And to think that you
should have come to Dalecourt! I don’t see how you ever found the
way! It is the very most wonderful thing I ever heard of! How did you
get here? But, no matter now. How thoughtless I am to stand here
asking all these questions. You look frozen and starved, poor child,
and the first thing is to get you home as quickly as possible. Who is
this with you? Not Uncle Phin! Surely not the Uncle Phin who used
to be so good to me when I was a little girl?”
“Yes, Miss Hatty,” answered the old man, who had scrambled
stiffly to his feet upon her entrance, and now stood with his white
head uncovered, laughing and crying at the same time. “Hit am de
same ole Unc Phin, an he tank de good Lawd he is lib to see a shuah
nough Dale once mo. He done bring lil Marse home, Miss Hatty. Hits
been powerful hard wuk; but de Lawd done sen He rabens, an He
fiery chariots, an He pillows ob smoke, an now He done sen you Miss
Hatty, like a bressed angel, fur to delibber us.”
“He has indeed been very good to us,” said the young lady, gently.
“Now we must get this dear child home at once.”
The carriage in which Miss Hatty was driving home from
Richmond, when her curiosity was attracted by the strange scene in
the little old cabin, was now brought to the door. Uncle Phin, feebly
protesting that it was all too fine and too grand for a “wuffless ole
niggah” like him, was made to take the front seat; while on the other
sat Miss Harriet Dale, with ragged, tired, hungry, but intensely
happy Arthur nestled close beside her.
The perplexing tumult of his feelings was such that, up to this
time, he had not spoken a word; and even now he wondered if it were
not all a beautiful dream, from which he would awake to find himself
lying on the floor of the cabin. It seemed as though his own dear
mother must have come back; that it was her loving arm now thrown
protectingly about him, and he almost feared to speak, lest she might
disappear, as she always did when he waked from dreaming of her.
But the beautiful lady was talking to him and asking him questions.
She could not wait until they reached home to learn how these two
had wandered from the far-away place in which she had met her
“Prince Dusty,” to this one. It was such a wonderful journey for them
to have undertaken, that her impatience to know something of it
could not be restrained. So she asked question after question, that
Arthur and Uncle Phin answered to the best of their ability, until at
length she knew enough of the principal events of their pilgrimage to
make it seem marvellous that they should ever have accomplished it.
Among other things she learned of their experience in the runaway
caboose of freight train No. 15, in the Alleghany Mountains, and this
seemed to interest her more than all the rest.
Then she wanted to know if the book from which Arthur had been
reading to Uncle Phin, and which he now carried clasped tightly in
both hands, could be the same that she had given him so long ago,
and how he had been able to keep it all this time.
“Of course it is,” answered Arthur, “and of course I have kept it. It
is the very most precious thing I own in the world; and nothing but
beautiful things, just like its stories, have happened ever since you
gave it to me. I had to let Rusty go to get us here; but I would never,
never, have let my book go, not even if we had been starving.”
Then Miss Hatty had to be told who Rusty was, and what a dear
dog he was, and how hard it had been to part with him, and how
Arthur hoped there would be some horses for him to hold at
Dalecourt, or errands to be run, so that he could earn money enough
to buy him back again.
It was too dark for them to see anything of the Park, once so
carefully kept, but now neglected and overgrown, through which they
drove for half a mile after turning in at the Dalecourt gateway; but
Arthur felt a thrill of happiness when his cousin told him where they
were. It seemed incredible that his long, weary journey, with all its
hunger and cold and suffering, was past, and that he was really at the
home he had so longed to reach. How beautiful it was to be
welcomed so warmly and lovingly, when he had sometimes feared
they might not even receive him at all.
At length the carriage stopped before a great rambling house, that
had been very stately and handsome in bygone years; but which was
now so dilapidated and shabby as to be but a forlorn relic of its
former glory. However, it still contained much of comfort and good
cheer; and, as the great front door was flung open, the warm glow of
a huge log fire sprang out upon the cold darkness, and drove it back.
It seemed to Arthur as though the very house offered him a welcome
of light and warmth, and he loved it from that moment.
From the open doorway stepped an elderly gentleman, with iron-
gray hair and mustache, and an erect military bearing, who called
out:
“Welcome home, Niece Harriet! We’ve had lonely holidays without
you; and right glad am I to have you back again.”
“No more so than I am to be here, uncle!” exclaimed Miss Hatty,
springing lightly from the carriage and heartily kissing the elderly
gentleman, who was Colonel Arthur Dale, of Dalecourt, and Arthur’s
grandfather. “And, uncle, I’ve brought home a friend of yours, whom
I picked up on the road. He is the very boy you were speaking of so
recently, who saved your train, in the Alleghanies, from a collision.”
“Eh! what’s that?” cried Colonel Dale. “You have found that boy?
How in the name of goodness—But bring him in! Bring him in where
we can have a look at him. It’s too cold to stand out here any longer.”
So the young lady followed her uncle into the glowing hall, leading
Arthur by the hand, while Uncle Phin hobbled after them. The boy’s
mind was filled with a whirl of conflicting emotions, as he stepped,
for the first time, across the threshold of his mother’s home, and
gazed on the form of his nearest living relative. Had he tried to speak
at that moment his feelings would have choked him; but he gave no
outward sign of his mental condition, except by clasping more firmly
the kind hand that led him forward.
When fairly within the circle of ruddy firelight, that filled the oak-
panelled interior with its cheery glow, Colonel Dale turned for a look
at the stranger whom his niece had so curiously discovered and
brought home with her. As his glance fell on the ragged little figure at
her side, the words that were upon his lips died away, a sudden
pallor overspread his countenance, and he gazed in silence.
What did he see in that sweet face, now so thin and careworn? In
its brave blue eyes? In the fair head of clustering ringlets? What was
it that, for a moment, rendered him speechless and powerless to do
aught save stare? It seemed to him that he saw a spirit.
“Who is he, Harriet?” he almost gasped, at length. “Where did you
find him? He is the living image of my dead daughter?”
“He is that dead daughter’s child, uncle. He is your own grandson
Arthur, and my little ‘Prince Dusty,’” was the answer.
The next instant the boy was clasped in a loving, forgiving, all-
atoning embrace, and had found a place in his grandfather’s heart,
that he would never resign so long as life lasted.
CHAPTER XXVI.
COLONEL DALE OF DALECOURT.

I t is hardly possible to describe the joy that reigned in Dalecourt on


that last night of the year. Colonel Dale and Miss Hatty, and Mrs.
Allen Dale, her mother, all asked Arthur questions at once; and
petted, and fed, and pitied, and praised him, until the poor, tired,
happy little fellow, worn out with excitement, could no longer keep
his eyes open, and was carried off to bed. Nor would it be possible to
convey any idea of what a hero dear old Uncle Phin became in the
eyes of the dusky assembly, who thronged the kitchen, to see him eat
his much needed supper, and to hear of his marvellous adventures
while bringing the “lil Marse” to his own home. All these things can
be imagined a great deal better than they can be described. At the
same time it does seem to be necessary to tell something about the
Dales and Dalecourt, and how Colonel Dale’s niece, Miss Harriet,
happened to be the same beautiful lady who presented Arthur with
an illustrated copy of Andersen’s “Fairy Tales,” in the oil region of
Pennsylvania, some months before that happy New Year’s Eve.
She was the only daughter of Colonel Dale’s youngest brother
Allen, and was therefore own cousin to Arthur’s mother. At the death
of her father, who left them penniless, she and her mother went to
Dalecourt to live, and to keep house for her lonely uncle.
One of the very dearest of Miss Hatty’s school friends lived in the
oil region of Pennsylvania, and during the previous summer she paid
this friend a visit. It was at the conclusion of this visit, and while
driving from her friend’s house to the distant railway station, that
she encountered Arthur and little Cynthia, just as their search for
adventures had led them into trouble.
With her first glance at the boy’s face she was struck by a certain
familiar expression in it, and when he told her his name she
wondered if he might not be her little cousin whom she had never
seen. She was not quite sure of the Dustin part of his name, as it was
never allowed to be mentioned at Dalecourt, so she decided to wait
until she could make further inquiries before claiming the
relationship.
As she had barely time to reach the railway station and catch her
train, she was not able to pursue these inquiries just then. She,
however, bade the coachman find out what he could about the
Dustins, and also wrote to her friend for what information she could
obtain concerning the child, in whom she had become so greatly
interested. From her mother she learned that Dustin was the name of
the young Northerner whom her cousin Virginia had married; and
when she received an answer to her letter, it assured her that she had
discovered, in that far-away region, her uncle’s only grandson.
Now came what she feared would prove the most difficult part of
her task. Colonel Dale had forbidden the name of Dustin to be
mentioned in his house, nor had Miss Hatty ever heard him speak as
though aware that he had a grandson living. She at first tried to
approach the subject cautiously, but finding that she was liable to be
misunderstood, she at length told her uncle frankly all that she knew
and suspected. To her great surprise he listened to her willingly and
with an eager interest.
Colonel Arthur Dale had been a very selfish man, though he called
his selfishness “family pride.” He had also been a very self-willed
one, though this he would have said indicated strength of character.
Of late years, however, both of these faults had been dealt heavy
blows. The losing of his beautiful daughter Virginia was the first
blow. Then his wife died, and then the war came. It left him a poor
man, with a large but unproductive estate on his hands, and no
opportunity, that he could discover, for going into business and
retrieving his shattered fortunes.
Instead of hardening his nature, these trials softened it. His pride
was broken. He no longer thought of himself alone. His stubbornness
disappeared and he longed for human love and sympathy. His once
princely estate was now so encumbered by mortgages that they
promised soon completely to overwhelm it. In spite of its owner’s
efforts to keep the place in order, it showed evidences of decay and
ruin in every direction. Many of the old family servants still clung to
Dalecourt, and the Colonel was too kind-hearted to turn them away.
Thus there was always a large number of mouths to feed, and each
year brought less to feed them with.
Of late the lonely man had thought much of his dead daughter, and
wondered if her son, the grandson whose existence he had never
openly acknowledged, was still alive, and what sort of a boy he was.
Thus, when his niece began to speak to him on this very subject, he
proved an eager listener to all that she had to say.
“He is one of the very dearest, sweetest, and bravest little fellows I
ever saw,” she cried impulsively. “When I met him he was making
believe to be a prince, and was defending a child, younger than
himself, from what he thought was the savage attack of a big dog. He
was so covered with dust when I picked him up out of the road, that I
called him ‘Prince Dusty,’ and the title of ‘Prince’ seems somehow
exactly to suit him. Although he was ragged and barefooted, he was
every inch a little gentleman, and the last I saw of him he was lifting
his tattered straw hat to me, as I drove away.”
The result of this conversation, and of several similar ones that
followed it, was that, toward the end of October, Colonel Dale set out
for the oil region of Pennsylvania, determined to bring his dead
daughter’s child home with him, and thereafter to treat him as his
own son.
He had, by this time, so set his heart upon having the boy to love
and to care for, and had centred so many plans for the future about
him, that to learn, from the Dustins, of Arthur’s absolute and
mysterious disappearance, was a grievous disappointment, for which
he was not prepared. He could not believe that the boy was not still
in that vicinity, and insisted that a search should be made for him
throughout all the surrounding country, though the runaways had
been gone for nearly a month.
Colonel Dale read and re-read the rudely pencilled note that
Arthur had left for Cynthia, and asked to be allowed to keep it: but
the child would not give it up. It was her most treasured possession,
and though he bribed her with money, and candy, and toys, she
could not be induced to part with it.
Brace Barlow, the only person who knew how and in what
direction Arthur and Uncle Phin had gone, was in a distant part of
the oil region, so that he heard nothing of Colonel Dale’s arrival, nor
of the eager search for the little fellow who used to call him “dear
giant.”
Arthur’s grandfather even visited the farm that had belonged to his
unacknowledged son-in-law, Richard Dustin, with the faint hope that
his grandson might have sought shelter there.
Finally, after obtaining John Dustin’s promise to telegraph the
first bit of information that he should gain concerning the missing
boy, and also to relinquish all claims upon him in favor of the
grandfather, the disappointed man turned his face homeward. He
was not only disappointed at the unexpected result of his journey;
but he was as heavy-hearted as though death had robbed him of
some loved one, and he were now on his way to bear the sad tidings
to those who waited at home.
It was such thoughts as these that drove sleep from his eyes, while
the Keystone express, on which he was a passenger, climbed the
western slope of the Alleghanies, and barely escaped destruction
from the runaway caboose of a freight train, through the prompt
action of a boy. If the sleepless man could only have known that this
boy was his own grandson, how quickly would his sorrow have been
changed to joy and pride. As it was, he was filled with admiration for
the brave lad, merely from listening to the sleeping-car porter’s
imperfect account of the affair, and wished he might have seen and
known him.
When he reached home he related this incident to his niece and
her mother as the most thrilling of his trip, and again regretted that
he had not made the acquaintance of its hero.
Now, the fact that his grandson and this young hero were one and
the same boy, and that this boy had voluntarily sought a home under
his roof, was a continual source of joy and pride to Colonel Dale, that
he was at no pains to conceal.
Becomingly dressed, well cared for, and, above all, surrounded by
an atmosphere of love and gentleness, “Prince Dusty” was now such
a handsome, merry little fellow, that he not only completely won the
hearts of his grandfather and the Dalecourt household, but of every
one who came in contact with him.
Now, more bitterly than ever, did Colonel Dale regret his lost
fortune, and shrink from the ruin that, staring him in the face, could
not much longer be averted. The financial difficulties of the family
had not been kept from Arthur, for he was wise beyond his years, and
his grandfather thought it best that he should know exactly how
matters stood with them. It was a great grief to the boy to see his
grandpapa and his Cousin Hatty, both of whom he had learned to
love dearly, so troubled; and, in his wise young way, he pondered
deeply over the situation.
At last, one evening as he was bidding them all good-night, he
said: “Grandpapa, I think I have almost thought of a way for us to get
a great deal of money.”
“Have you, my boy?” said the colonel. “That’s good; what is it?”
“Well I haven’t quite thought it all out yet; but I will finish thinking
and tell you what it is in the morning,” replied the boy, smiling
brightly down upon his grandfather, as he bounded up the broad
stairway.
CHAPTER XXVII.
A “GENUINE CHUMP.”

I t seemed so absurd that a twelve-year-old boy should be


considering plans for raising the large sum of money necessary to
help Colonel Dale out of his difficulties, that, after Arthur had gone
to bed, those who were left down-stairs found considerable
amusement in wondering what his scheme could be.
His grandfather said it would probably be a proposition to form an
errand-boy trust; while Mrs. Dale thought it would only prove to be
some absurd idea concerning railroad life, that the boy had picked up
during his recent travels. Miss Harriet, however, said that her
“Prince Dusty” was wiser than they imagined, and she did not believe
he ever spoke seriously, upon any subject, without knowing pretty
well what he was saying. So, by talking the matter over, they became
greatly interested, and quite curious to hear what Arthur would have
to say the next morning.
When they began to question him at breakfast time he gravely
answered that he had heard his papa say that the breakfast-table was
not the proper place to discuss business affairs. The seriousness with
which this speech was uttered, caused a general smile, and as Colonel
Dale had been heard to make the very same remark, no objections
could be raised against it.
After breakfast the little fellow invited his grandfather to
accompany him into the library, where he proceeded to unfold his
plan. It was nothing more nor less than that they should go back to
Pennsylvania, and sink a well, for oil, on the farm that his father had
left him.
For a moment Colonel Dale looked at the boy to see if he were in
earnest, and then burst into a hearty laugh. “Why, Arthur!” he said at
length, “whatever put such an idea into your head? I don’t know the
first thing about oil wells, and I am afraid that, wise as you are, you
don’t know much more than I do.”
“That’s just it, sir!” replied the boy, eagerly. “And it is because both
of us are ‘chumps’ that we’ll be certain to strike oil. Brace Barlow
always said so. You see, a ‘chump’ is somebody who doesn’t know
any more about oil, or where to find it, than we do. What Brace
Barlow says is, that while those who know all about the business
often strike ‘dusters,’ a ‘genuine chump’ always has luck with his first
well. Now, you are a ‘genuine chump,’ you know. I’m afraid I am not
quite genuine, because Brace Barlow has told me so much about the
business, and because I helped him shoot a well. But, I think you
must be genuine enough for both of us. It’s a perfectly splendid way
to make money, unless you strike a ‘duster,’ but only ‘sharps’ do
that.”
“What do you mean by ‘dusters’ and ‘sharps’? They sound
exceedingly like slang words,” said Colonel Dale, smiling.
“Oh, no, indeed, they are not!” cried Arthur. “Brace Barlow uses
them, and so does Uncle John. A ‘duster’ is a dry well—one that
doesn’t have any oil, you know; and a ‘sharp’ is one who understands
all about the oil business. He is just the most different kind of a man
from a ‘chump,’ and is nearly always too wise to make money.”
“But, my boy, your farm is not even in the oil region; so what
makes you fancy that we could strike oil by sinking a well on it?”
asked Colonel Dale.
“Because I know two secrets about it,” answered the boy,
mysteriously. “One day when papa and I were walking in the back
wood-lot, we smelled gas, and by and by we found a tiny place in the
rocks where it came out. Papa lighted it, and it burned beautifully.
Then he put it out, and told me always to remember that place, but
not to say anything about it to anybody until the proper time came.
After that papa studied a great deal about oil, and he found out that
our farm was on the forty-five degree line, and said he was quite sure
that oil would some day be found on it.
“So, while he didn’t tell anybody but me about it, he made Uncle
John promise never to sell the farm. I have thought several times,
when I needed money, that I would go back to my farm and get some
oil to sell; but then it has always come some other way, so I haven’t
had to touch it. Then I thought I would save it, until I was ready to be
a railroad man, and wanted to build a railroad of my own. Now I
have decided that I would rather you should have it than to do
anything else in the world with it, and then you can make Dalecourt
beautiful again, and we can always live here and be happy.”
Although at the time Colonel Dale made light of his little
grandson’s plans for acquiring wealth, this curious conversation set
him to thinking, and to looking up all the information concerning oil
that he could obtain. The more he considered the scheme, the more
favorably he was impressed with it, and the more inclined he was to
attempt it.
Mrs. Allen Dale thought it was all nonsense; but Miss Harriet was
delighted with it, and begged her uncle to undertake it. “Just think!”
she exclaimed, “how fine it would be, if our little ‘Prince Dusty’
should turn out to be a little oil Prince. Wouldn’t it be splendid?”
At length, when the winter had passed, and the Virginia forests
were putting on their delicate spring robes of leaves and blossoms,
Colonel Dale decided to make the venture, and to sink a “wild-cat”
well on the Pennsylvania farm belonging to his grandson, with the
hope of finding oil.
It was a curious thing for a staid and elderly Virginia planter to
undertake; and, but for the desperate state of his fortunes, it is
doubtful if he would have considered the plan for a moment. As it
was, he mortgaged Dalecourt for the very last cent that could
possibly be raised on it, and, with the few thousand dollars thus
obtained, started for Pennsylvania.
Arthur and Miss Harriet accompanied him; the former, as a matter
of course, because, as he said, he was to be his grandpapa’s partner
in this new business. The latter went to keep house for them while
the well was being sunk, and to continue Arthur’s education, which
she had undertaken when he first came to Dalecourt. Mrs. Dale was
to remain in charge of the beautiful old place, which might so soon
pass into the hands of strangers, and Uncle Phin was also left behind
to fill the responsible position of head gardener.
On the morning that the little party set forth on the journey that,
to them, promised as much of glorious success or disastrous failure
as did ever an ancient voyage of discovery or exploration, Arthur was
enthusiastic over their undertaking, and confident of its complete
success. Miss Harriet was smiling and hopeful. Colonel Dale was
serious, and his face wore an air of quiet determination; while Mrs.
Allen Dale was tearful and doubtful. She bade them good-bye as
though she never expected to see them again; and, when they were
gone, she gazed as sadly about her, as though the last hope of
Dalecourt had departed with them.
The journey was a rapid and pleasant one, occupying but two days
and one night, which was in striking contrast to the three months
spent by Arthur and Uncle Phin in traversing the same distance.
Arthur did not manifest much interest in Washington, as they
passed through it. He had suffered too much there to care to renew
his associations with the place. He only looked eagerly from the car
window at all the dogs that were to be seen, with the faint hope that
one of them might be his dear Rusty.
At Harrisburg he tried to point out to his companions Conductor
Tobin’s cottage; and, from there to Pittsburgh, he felt almost certain
that every freight train they passed must be No. 15, and that on each
he recognized Brakeman Joe. He was greatly disappointed that they
did not have time to go and see Aunt Charity; for he gratefully
remembered all those who had been kind to him in the time of his
need, and would gladly have renewed their acquaintance.
CHAPTER XXVIII.
A FEW FACTS CONCERNING PETROLEUM.

A s they approached the oil region, and began to see the tall
derricks, looking like windmill towers, crowning the hilltops,
their conversation naturally turned upon the subject of oil and its
production. Arthur related stories from Brace Barlow’s experience;
while Colonel Dale, who, from weeks of reading, was now as well
informed on all matters pertaining to oil as one can be from books
alone, gave them bits of information concerning its early use and
history.
One of Arthur’s stories described the fearfully narrow escape his
“dear giant” once had from a runaway team. He was driving along a
lonely road that ran in the bottom of a narrow valley, and had sixty
quarts of nitro-glycerine snugly stowed under the seat of his buggy.
Suddenly he saw a runaway team attached to a heavy lumber wagon,
dashing at a mad gallop down the road, directly toward him. There
was barely time to turn his own horses into the ditch at one side, and
thus leave a narrow space through which the runaways might have
passed in safety, if they had so chosen.
Instead of doing this, they too headed for the ditch, and plunged
into it, just in front of the glycerine buggy. There they fell over each
other, broke the pole, upset their wagon, and became so entangled in
the wreck that they were incapable of further mischief. All this took
place within ten feet of where Brace Barlow sat, on top of his load of
nitro-glycerine, as steadily as though he did not expect, with each
instant, to be blown into a million fragments, and hurled into
eternity.
Then Colonel Dale explained what torpedoes are, and why they are
used; and Miss Hatty said she hoped their well would have to be
shot, so that she might witness the operation. Seeing that his
companions were interested in the subject, the Colonel continued to
talk of it. He said:
“Although we, naturally, know and hear more about the oil fields
of Pennsylvania than any other, petroleum is also found in a dozen or
more of our own States and territories, as well as in many other
countries of the world. In Pennsylvania it exists in a narrow territory,
lying about fifty miles west of the Alleghany Mountains; and, as the
oil-bearing belt extends in a general northeast and southwest
direction, it is spoken of as lying on a forty-five-degree line.”
“Just as our farm does,” said Arthur.
“Exactly,” said his grandfather, “and I only hope it may not lie over
one of the many barren places that exist on that line.”
“In this part of the country,” he continued, “the drilling of wells
and the handling of oil have been reduced to a state of perfection and
simplicity unknown elsewhere. Consequently, Pennsylvania well
drillers, with their tools, are in demand in many foreign oil fields,
and may be found, commanding large salaries, in Russia, Japan,
China, New Zealand, Canada, the various countries of Western South
America, in several of the West Indian islands, and elsewhere.
“In China immense oil fields exist, in which wells, drilled centuries
ago, are still in use. Natural gas has also been used in that country for
hundreds, and perhaps thousands, of years. It is conveyed from the
wells through bamboo pipes tipped with rude clay burners.
“Petroleum has also been known and used in Burmah for an
unknown length of time, both for light and fuel. Into a shallow oil
well of that country an iron bucket is lowered by means of a rope,
passing over a wooden cylinder. When the bucket is full, two men
take hold of the other end of the rope, and, by running down an
inclined plane as long as the well is deep, draw it to the surface.”
“What a stupid way,” said Miss Hatty.
“Havana, Cuba,” continued Colonel Dale, “was originally named
‘Carine,’ for it was the place where the early voyagers to the new
world careened their vessels and made their seams water-tight with
the natural pitch, or solidified petroleum, that oozed in abundance
from the rocks near the shores of the harbor. Oil springs are very
numerous in Cuba, as they are in many others of the West Indian
islands.”
“Wouldn’t it be good if we could find a flowing oil spring on our
farm?” said Arthur, his eyes glistening at the prospect.
“It would certainly be very pleasant,” replied his grandfather.
“And, speaking of flowing springs, the most wonderful flow of
petroleum ever seen in any country, occurred in 1862 in the town of
Enniskillen, in the western part of the Canadian Province of Ontario,
along the borders of a stream called Black Creek. At that time there
was so little demand for oil that it was only bringing ten cents a
barrel, though three years later it was worth ten dollars a barrel in
gold.
“The first well in that region was drilled early in the year; and, at
the depth of only one hundred feet, it entered an immense reservoir
of petroleum. Although oil was of so little value at that time, the
reckless settlers of the country seemed possessed of a rage for
drilling wells, apparently merely for the pleasure of seeing it flow
from them. Some of these rudely drilled wells spouted forth
thousands of barrels of oil in a day, and one of them is computed to
have flowed at the rate of 10,000 barrels in twenty-four hours. All
these fountains and rivers of oil were allowed to run absolutely to
waste. The waters of Black Creek were covered by it to a depth of six
inches, and it formed a film over the entire surface of Lake Erie.
“At length this vast quantity of oil was set on fire by some
mischievous person, who wished to see what the effect would be. For
days Black Creek was a torrent of raging flames, that leaped and
roared with inconceivable fury and grandeur. It was such a sight as
the world never had seen, and probably never will see again; while
the Canadians were so thoroughly satisfied with their experiment
that they have had no desire to repeat it since.
“It is estimated that, during the spring and summer of 1862, no
less than five millions of barrels of oil ran to waste down the channel
of Black Creek. Three years later that amount of oil would have been
worth, in the United States, a hundred million of dollars.”
“My!” exclaimed Arthur, drawing a long breath. “I don’t believe I
should know what to do with so much money as that.”
“I am afraid you wouldn’t, dear,” laughed Miss Hatty. “I know that
I for one would not dare assume the responsibility of taking care of,
and spending, such an enormous sum. Why, the man who has one
hundredth part of that, or one million, has more money than many
princes, and is wealthy beyond the average conception; while he who
has but a thousandth part of it, or one hundred thousand dollars, is
still a rich man.”
Although Arthur hardly comprehended these figures, they
interested him, and he now asked: “How many barrels of oil will we
have to get out of our well, grandpapa, to give us as much money as
we need?”
“That is rather a hard question to answer,” laughed Colonel Dale;
“for, as a general thing, the more money people have, the more they
think they need. However, always supposing that it is not a ‘duster,’
as you have taught me to call a dry hole, if our well yields twenty-five
barrels a day I shall be pleased. If it should yield fifty barrels I should
be perfectly satisfied; while with a daily yield of one hundred barrels,
I should be amazed and delighted. In that case you might well be
called a ‘little oil Prince’; for, with oil at three dollars per barrel, your
income would be at the rate of a hundred thousand dollars a year.”
“But suppose it should yield more than a hundred barrels a day?”
persisted Arthur. “How would you feel then?”
“I am sure I do not know,” laughed his grandfather, “for I cannot
conceive of such a thing as happening. I expect I should feel
something as Mr. Kier of Pittsburgh did in 1860, when the oil that he
had been getting at the rate of two or three barrels a day from his salt
wells, and selling as a medicine for fifty cents a half pint, was
suddenly produced in such quantities that the price fell to about ten
cents per barrel. So, if our well should flow too freely, I should be
afraid that its product would become a drug on the market.”
“Just what Mr. Kier’s had been, but ceased to be,” laughed Miss
Hatty.
“What?” asked Arthur, innocently.
“Why, a drug on the market. Didn’t uncle say that it was formerly
sold as a medicine?”
“Oh, yes,” said Arthur, soberly, “I see.”
Just then Miss Hatty, who was very fond of figs, invested ten cents
in a small box of “fig tablets,” as the train-boy called them. She and
Arthur at once began to eat them with evident relish, but Colonel
Dale refused the proffered box.
“What do you suppose you are eating?” he asked, smiling.
“Why, figs of course,” answered Miss Hatty.
“Do you call that a fig leaf?” asked her uncle, pointing to one, cut
from green paper, that lay on top of the box.
“No, certainly not. That is only an imitation leaf,” was the answer.
“Well, it is just as much a real leaf as those are real figs.”
“Why, grandpapa, they have seeds in them!” exclaimed Arthur, as
though that was proof positive that they must be real figs.
“To be sure they have,” laughed Colonel Dale. “The imitation
would not be a good one if the seeds were left out. In spite of their
seeds, those figs are made of petroleum; or rather of paraffine, which
is one of the important products of petroleum. Not long ago I came
across a list of over two hundred articles of commerce that are
manufactured directly from this wonderful oil. Among them were
these very ‘fig tablets.’ Other things made from paraffine are
chewing-gum, jujube paste, gum-drops, some jellies and jams, icing
for cakes, etc. The list also contained the names of all our most
brilliant dyes, which are produced from the very lowest residuum of
petroleum tar, and several drugs, among which was a powerful
anæsthetic.”
“Well,” said Miss Hatty, “I am glad I am not so wise as some
people. It is very foolish to know too much; for it takes half the
pleasure out of life. Now I am sure I don’t care to eat any more of
these kerosene figs, even if they have got seeds in them; and yet a
minute ago I thought them quite good.”
“Seems to me,” said practical little Arthur, “that it is more foolish
not to eat a thing that tastes good, if it won’t do you any harm, no
matter what it is made of, than it is to be wise.”
“And it seems to me,” said Colonel Dale, “that we had better be
collecting our things and preparing to leave the train; for here is the
station at which we are to get off.”
CHAPTER XXIX.
LOCATING AN OIL WELL.

I t was a comfortable, low-roofed, stone farmhouse, at which the


stage deposited our travellers, after a pleasant drive from the
railway station. To Arthur it seemed very much like a home, so filled
was it with memories of his dear father. As Colonel Dale had notified
the neighbor, who had it in charge, of their coming, everything was
in readiness for them. The house had been aired and swept, its plain
but serviceable furniture dusted and cleaned, lights were burning in
all the lower rooms, and supper was nearly ready.
Miss Hatty, who had never been there before, was charmed with
the place, and hoped that if they lost Dalecourt they could make their
home here in “Prince Dusty’s” castle.
They did not tell anybody why they came into that out-of-the-way
part of the world, and many were the discussions throughout the
scattered neighborhood as to the object of their visit. At length old
Deacon Thackby thought he had discovered the secret and he
announced the fact, with a wise look on his shrewd face, as he and
several others stood on the church steps after a Friday evening
meeting.
“I figgered out yesterday,” he said, “why them Dales come here and
settled down like they was going to stay.”
“I thought maybe from the way I see him peering round that p’raps
he was perspecting fer ile,” piped a thin voice at the Deacon’s elbow.
“Ile!” snorted the Deacon, contemptuously. “You’ve got ile on the
brain, brother Moss. Ef thar was any ile raound here wouldn’t some
of us that was borned and brung up in the place have diskivered it
long ago? Do you suppose a stranger, who I reckin never seed a drap
of crude in his life, is a comin to tell us what we never knowed about
our own kentry, nor what our fathers never knowed, nor what
nobody never will know?”
“Well——” said the thin voice.
“Well!” interrupted the Deacon. “There’s no use talking. It may be
ile that has brung ’em here; but it’s paint ile, an not petroleum. That
young woman is one of them artiss’s that you hear so much about
nowadays, an she’s here to do some paintin. The boy wanted to come
naturally ’cause it was his home, an the old Cunnel he come to look
after ’em. That’s all thar is about it.”
“What makes you think the young lady is an artist, Deacon?” asked
another of the group.
“I don’t think, I know,” replied Deacon Thackby, decidedly, “an
how I know is ’cause I seen her at it, and ’cause she’s cranky and
pernicketly like they all is. Why, last Wednesday she come down to
my old red mill an did a drawring of it, an called it a beautiful color
subjec, an said she was comin down agin yesterday afternoon to do it
in iles. Well, you know how drefful shabby-looking the old place was,
all kinder cluttered up, an the paint wore off in patches, an them
vines hiding the best half of it.
“It seemed too bad to have her wastin her time on sich as it was, an
I didn’t want folks to look at her picter, when it was done, an say how
shifless I was nohow. So I got the boys out by the break o’ day, an we
put in some good solid work on that mill agin the time she got thar.
We tore down all them pesky vines an burned them up, an cut away
the bushes so as to make a good airy clearin all raound. Then we
turned to an giv the hull outside a fustclass coat of whitewash, from
ruff to suller, an made it look fine.
“We hadn’t more’n finished when she come along with all her
fixins, ready to do it up in iles; but when I went out to show her what
we’d done she didn’t seem a mite grateful. She jest looked
disappointed an miserable an said ‘Oh, Deacon, how could ye?’
“Then she went off, like she felt real bad, an awhile arterwards I
see her settin on the big rock in my hill pasture, wastin all her paints
on one of them common pink an white apple-trees, such as you
might see most any day bout this time o’ year. Oh, yes, she’s a artiss,
an cranky like they all is.”
In the meantime Colonel Dale was quietly, but actively, making
preparations to sink a well, in search of the wealth of oil that he
hoped lay hidden beneath the Dustin farm. On the very first morning
after they reached there he and Miss Hatty and Arthur visited the
place in the back wood-lot where Mr. Dustin and his son had
discovered the tiny gas jet issuing from the rocks. Arthur readily
found it again, and again the application of a lighted match gave
proof that it was genuine gas and would burn.
Then the Colonel said he would leave the location of the well to his
little partner, and asked him to point out the place where he wished
the derrick to stand.
The boy walked hesitatingly around the gas jet for a minute, and
then, returning to where the others stood, said:
“Don’t you think, grandpapa, that Cousin Hatty ’d better be the
one to say where it shall stand? You see I know so much about oil,
and you have got so wise lately, that I am afraid we are not quite such
‘chumps’ as we ought to be; but Cousin Hatty is a real genuine, and
doesn’t know anything at all. About oil, I mean!” he added quickly,
blushing furiously. “Of course she knows everything else, and that’s
what makes her the very best kind of a ‘chump.’”
“Something like—
“‘The pork-pie man’s beautiful daughter
Who rarely knew what she had orter;
And in quenching a fire,
Once sought to rise higher,
Using ile, instead of cold water,’”

laughed Miss Hatty. “However, I will consent to act as the ‘chump’ of


this party for the sake of the common good, and I decide that the well
shall be sunk on this very spot.” Here the young lady thrust a bit of
stick into the ground where she was standing. It was about a hundred
feet from the little gas jet, on the side nearest the house, and Miss
Hatty afterwards acknowledged that she selected it because it was
visible from her window, and she wanted to be able to see the derrick
when it was built.
The spot where that bit of stick stood in the ground instantly
acquired a new interest. It almost seemed as though they could see
the tall derrick that was to rise there, and hear the steady thud of the
drill as it cut its way down through earth and rock to the oil-bed. The
very air seemed to be filled with the odor of petroleum; but perhaps
it was only a whiff of the gas driven towards them by a puff of wind.
At any rate, they felt that a beginning had been made now that the
site of the well was decided upon, and were more than ever anxious
to have the work go speedily forward.
Soon afterwards Colonel Dale visited the old oil region, some
twenty miles away, in which Mr. John Dustin lived, to purchase the
necessary supplies for his well, and to engage experienced men to
come and drill it. It was while he was thus absent that Deacon
Thackby persuaded the neighborhood that the Dales were only there
because Miss Hatty was an “artiss.”
The neighborhood was indeed astonished when it discovered one
day that several loads of lumber had been hauled from the railway
station to the Dustin farm, and that a “rig-builder” was at work with
his men erecting a derrick in the back wood-lot.
“What in the name of common-sense!” ejaculated Deacon
Thackby, when he first heard of what was going on.
“Didn’t I tell ye I thought they was perspecting round fer ile?”
piped brother Moss’ thin voice.
“But thar ain’t no ile within twenty mile of here,” cried Deacon
Thackby. “The man must be a born natural to come wild-catting
down here, and I’m jest a going to tell him so.”
And the Deacon did tell Colonel Dale how foolishly he was, wasting
his money, and how perfectly useless it was to drill for oil in that part
of the country, where, if there was any, it would have been
discovered long ago.
“Has anybody tried sinking a well in this vicinity?” asked Colonel
Dale.
“Yes, thar was Sile Pettis put one down ’bout a year ago; but it
didn’t mount to nothing. Thar warn’t no ile into it.”
“How deep did he sink it?” inquired the Colonel, with interest.
“Well, not more than four hundred foot or so,” admitted the
Deacon, reluctantly.
“And the ‘third sand,’ which is the only one in this region that pays
—or at least so I am told,” remarked the Colonel, “is hardly ever
struck at a less depth than one thousand feet. Is Mr. Sile Pettis’
unproductive well the only thing that makes you think there is no oil
about here, Deacon?”
“Thar ain’t no surface indications, like thar should be if the ile was
right down under us.”
“That is something we must provide for at once,” laughed Arthur’s
grandfather. “I realize that we must have them, Deacon, and just as
soon as I get this well down a thousand feet I will try and show you
some of the finest surface indications in the country.”
CHAPTER XXX.
THE DALE-DUSTIN MYSTERY.

A lthough Colonel Dale talked thus bravely and cheerfully, he


could not drive away a heavy, sinking feeling from his heart, nor
prevent the furrows in his face from growing deeper and deeper, as
he thought of how much depended upon the result of this experiment
that everybody about him said was such a foolish waste of both time
and money.
Still the work was pushed steadily forward. The graceful derrick
was run rapidly up to a height of sixty feet, and a strong iron pulley
wheel was suspended from its crown. On the derrick floor, at one
side, the great bull wheels, about the shaft of which the drill rope was
to be wound, were placed in position. On the opposite side was set
the solid samson post that was to support the equally solid walking
beam. The former was a section of the squared trunk of an oak tree,
let deep into the ground; while the walking beam was a long and very
strong oaken timber, nicely balanced so that it would work readily up
and down. To the end of the walking beam, that reached into the
middle of the derrick, were to be attached the heavy drills; while the
other end was connected with the ten-horse-power engine that stood
in a rough shed but a short distance from the derrick.
Still beyond this, in the open air, was a rusty boiler, with a pipe
discharging into its open furnace door. This pipe led from a small
tank that was filled by the jet of natural gas, discovered by Arthur
and his father; and natural gas was to be the only fuel used in drilling
and operating the Dale-Dustin well.
At length, after a month of hard work and vexatious delays, the
“rig-builders” finished their labors, and the well drillers came in their
place. To Arthur’s great joy, they were headed by his “dear giant,”
Brace Barlow, who, having heard that his little friend was interested
in a new oil well, applied for and obtained the contract for drilling it.
“And Arthur, lad,” he said, after the first warmth of their greeting
was over, “if this well proves a ‘duster,’ it won’t be because it isn’t
drilled fair enough, or deep enough. I’ll keep the temper screw
turning, and the drill going, till we strike something to stop it, if it’s
only an order to quit, or the bottom of the appropriation.”
Brace Barlow brought with him a delightful surprise for Arthur in
the person of his Cousin Cynthia, who, upon Miss Hatty’s invitation,
came to make a visit at Dustin farm. The two children enjoyed each
other so thoroughly that it was a pleasure to see them together.
Arthur had so much to tell and Cynthia so much to hear concerning
his wonderful journey to Dalecourt, and they had so many plans to
make for the future, that the days were not half long enough for
them. In the evenings, when the day’s work was done, Arthur
generally sat with Brace Barlow, listening to his tales of adventure in
the oil region, or relating incidents of the recent journey, in which
Brace was fully as much interested as Cynthia.
Thus the boy discovered how the mysterious five-dollar bill came
to be in his precious book, and Brace learned of what service it had
been to them.
Day after day the powerful drills worked steadily downward
through hard and soft rock, sometimes descending only six or eight
feet in twenty-four hours, but generally cutting through twenty or
thirty feet of material in a day. The first and second sandstones or
“sands” were passed, and at length the drill was down a thousand
feet. At this depth it had not yet reached the third, or oil-bearing,
sandstone. Occasional puffs of gas came up through the casing of
iron pipe that was driven down as fast as a hole was cut to receive it;
but there was no sign of oil.
The work had now been prosecuted for two months, and with the
passage of time, and the rapid melting away of the few remaining
dollars of his fortune, Colonel Dale’s face grew more furrowed and
careworn, and, though he still tried to maintain a brave front, it was
evident that anxiety was telling heavily upon him.
As the opening of a new district has a very decided effect on the oil
market, all brokers who deal in oil or oil stocks are, of course,
anxious to secure the earliest information concerning the prospects
of the first well sunk in it. If this proves to be a dryhole, and the

You might also like