100% found this document useful (3 votes)
97 views

Instant download Hands On Functional Programming in Rust 1st Edition Andrew Johnson pdf all chapter

Functional

Uploaded by

darrenhouha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
97 views

Instant download Hands On Functional Programming in Rust 1st Edition Andrew Johnson pdf all chapter

Functional

Uploaded by

darrenhouha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.

com

Hands On Functional Programming in Rust 1st


Edition Andrew Johnson

https://textbookfull.com/product/hands-on-functional-
programming-in-rust-1st-edition-andrew-johnson/

OR CLICK BUTTON

DOWNLOAD NOW

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


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

Programming Rust 1st Edition Jim Blandy

https://textbookfull.com/product/programming-rust-1st-edition-jim-
blandy/

textboxfull.com

Asynchronous Programming in Rust 1st Edition Carl Fredrik


Samson

https://textbookfull.com/product/asynchronous-programming-in-rust-1st-
edition-carl-fredrik-samson/

textboxfull.com

The Rust Programming Language Covers Rust 2018 Steve


Klabnik

https://textbookfull.com/product/the-rust-programming-language-covers-
rust-2018-steve-klabnik/

textboxfull.com

The Rust Programming Language 1st Edition Steve Klabnik

https://textbookfull.com/product/the-rust-programming-language-1st-
edition-steve-klabnik/

textboxfull.com
Programming WebAssembly with Rust 1st Edition Kevin
Hoffman

https://textbookfull.com/product/programming-webassembly-with-
rust-1st-edition-kevin-hoffman/

textboxfull.com

Network Programming With Rust 1st Edition Abhishek Chanda

https://textbookfull.com/product/network-programming-with-rust-1st-
edition-abhishek-chanda/

textboxfull.com

Hands On MQTT Programming with Python Gaston C. Hillar

https://textbookfull.com/product/hands-on-mqtt-programming-with-
python-gaston-c-hillar/

textboxfull.com

Asynchronous Programming in Rust 1 / converted Edition


Carl Fredrik Samson

https://textbookfull.com/product/asynchronous-programming-in-
rust-1-converted-edition-carl-fredrik-samson/

textboxfull.com

Making Sense of the ECG: A Hands-On Guide Andrew Houghton

https://textbookfull.com/product/making-sense-of-the-ecg-a-hands-on-
guide-andrew-houghton/

textboxfull.com
Hands-On Functional
Programming in Rust

Build modular and reactive applications with functional


programming techniques in Rust 2018

Andrew Johnson

BIRMINGHAM - MUMBAI
Hands-On Functional Programming in Rust
Copyright © 2018 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, without the prior written permission of the publisher, except in the case of brief quotations
embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented.
However, the information contained in this book is sold without warranty, either express or implied. Neither the
author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to
have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products
mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy
of this information.

Commissioning Editor: Richa Tripathi


Acquisition Editor: Karan Sadawana
Content Development Editor: Tiksha Sarang
Technical Editor: Adhithya Haridas
Copy Editor: Safis Editing
Project Coordinator: Prajakta Naik
Proofreader: Safis Editing
Indexer: Rekha Nair
Graphics: Jisha Chirayil
Production Coordinator: Shantanu Zagade

First published: May 2018

Production reference: 1300518

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-78883-935-8

www.packtpub.com
mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as
well as industry leading tools to help you plan your personal development and advance
your career. For more information, please visit our website.

Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos
from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at service@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters, and receive exclusive discounts and offers on Packt books and
eBooks.
Contributors

About the author


Andrew Johnson is a software developer who has worn many hats. Professionally, he has
worked on projects written in C, C++, Java, Python, Ruby, JavaScript, Haskell, OCaml, and
now Rust. Most notably, he has worked as an early employee at Topsy Labs (acquired by
Apple) and FiscalNote (growing rapidly). Academically, his interests are focused on the
intersection between formal language processing (such as programming languages) and
existing natural language programming techniques.
About the reviewer
Sebastian Dröge is a free software developer currently working with Centricular Ltd. He
has been involved for more than 10 years with the GStreamer project, a cross-platform
multimedia framework. He also contributes to various other projects, such as Debian,
GNOME, Rust, and WebKit. While finishing his master's degree in computer science, he
started working as a contractor on free software and continues to do so to this day.

Packt is searching for authors like you


If you're interested in becoming an author for Packt, please visit authors.packtpub.com
and apply today. We have worked with thousands of developers and tech professionals,
just like you, to help them share their insight with the global tech community. You can
make a general application, apply for a specific hot topic that we are recruiting an author
for, or submit your own idea.
Table of Contents
Preface 1
Chapter 1: Functional Programming – a Comparison 6
Technical requirements 6
Reducing code weight and complexity 7
Making generics more generic 7
Functions as values 9
Iterators 11
Compact legible expressions 11
Strict abstraction means safe abstraction 14
Scoped data binding 14
Algebraic datatypes 17
Mixing object-oriented programming and functional programming 20
Improving project architecture 22
File hierarchy, modules, and namespace design 22
Functional design patterns 24
Metaprogramming 29
Summary 33
Questions 33
Further reading 34
Chapter 2: Functional Control Flow 35
Technical requirements 35
Designing the program 36
Gathering project requirements 36
Architecting a code map from requirements 37
Creating a Rust project 37
Writing stubs for each program requirement 38
Implementing program logic 40
Filling in the blanks 41
Parsing input and storing as building description and floor requests 41
Updating location, velocity, and acceleration 42
If the next floor request in the queue is satisfied, then remove it from the queue 43
Adjusting motor control to process the next floor request 44
Printing real-time statistics 46
Printing summary 48
Breaking down long segments into components 51
Searching for abstractions 52
Writing tests 55
Unit testing 55
Table of Contents

Integration testing 57
Summary 59
Questions 60
Chapter 3: Functional Data Structures 61
Technical requirements 61
Adjusting to changing the scope of the project 62
Gathering new project requirements 62
Architecting a change map from requirements 62
Translating expectations into requirements 63
Translating requirements into a change map 64
Mapping requirements directly to code 64
Writing the physics simulator 65
Writing the motor controller 69
Writing the executable to run a simulation 74
Writing the executable to analyze a simulation 78
Running simulations and analyzing data 81
Summary 85
Questions 85
Chapter 4: Generics and Polymorphism 86
Technical requirements 86
Staying productive during downtime 87
Learning about generics 87
Investigating generics 88
Investigating parametric polymorphism 90
Investigating generalized algebraic datatypes 93
Investigating parametric lifetimes 97
Defining lifetimes on ground types 97
Defining lifetimes on generic types 97
Defining lifetimes on traits 98
Defining lifetime subtyping 98
Investigating parametric types 99
Applying parameterization concepts 101
Parameterizing data 101
Parameterizing functions and trait objects 104
Parametric traits and implementations 106
Summary 110
Questions 110
Chapter 5: Code Organization and Application Architecture 111
Technical requirements 112
Shipping a product without sacrificing quality 112
Reorganizing the project 113
Planning content of files by type 114
Organizing the motor_controllers.rs module 115

[ ii ]
Table of Contents

Organizing the buildings.rs module 115


Planning content of files by purpose 116
Organizing the motion_controllers.rs module 116
Organizing the trip_planning.rs module 116
Organizing the elevator_drivers.rs module 116
Planning content of files by layer 116
Organizing the physics.rs module 117
Organizing the data_recorder.rs module 117
Planning the content of files by convenience 117
Organizing the simulate_trip.rs executable 117
Organizing the analyze_trip.rs executable 117
Organizing the operate_elevator.rs executable 118
Mapping code changes and additions 118
Developing code by type 118
Writing the motor_controllers.rs module 118
Writing the buildings.rs module 120
Developing code by purpose 121
Writing the motion_controllers.rs module 121
Writing the trip_planning.rs module 122
Writing the elevator_drivers.rs module 123
Developing code by layer 124
Writing the physics.rs module 124
Writing the data_recorders.rs module 126
Developing code by convenience 128
Writing the simulate_trip.rs executable 128
Writing the analyze_trip.rs executable 129
Writing the operate_elevator.rs executable 132
Reflecting on the project structure 134
Summary 134
Questions 135
Chapter 6: Mutability, Ownership, and Pure Functions 136
Technical requirements 136
Recognizing anti-patterns of ownership 137
Inspecting the microcontroller drivers 137
Inspecting the type and trait definitions 139
Defining the OverrideCode enum 139
Defining the ErrorCode enum 140
Defining the AuthorizedSession struct and deconstructor 140
Authorizing sessions 141
Checking errors and resetting state 141
Privileged commands 142
Normal commands 143
Querying library and session state 143
Inspecting the foreign library tests 144
Issuing override codes 145
Accessing status information and sessions 145
Deactivating active sessions 146

[ iii ]
Table of Contents

Issuing normal commands 148


Issuing privileged commands 149
Denying unauthorized commands 150
Inspecting the Rust tests 150
Rust authorization with sessions 150
Rust sharing session reference 152
Privileged commands 153
Unprivileged commands 154
Denying access to privileged commands 154
Learning the rules of ownership 155
When the owner goes out of scope, the value will be dropped 156
Using immutable data 158
Fixing the hard-to-reproduce bug 158
Preventing hard-to-reproduce bugs 160
Using pure functions 162
Summary 166
Questions 167
Chapter 7: Design Patterns 168
Technical requirements 168
Using the functor pattern 169
Using the monad pattern 173
Using the combinator pattern 177
Parser combinators 178
Using the lazy evaluation pattern 184
Summary 193
Questions 193
Chapter 8: Implementing Concurrency 194
Technical requirements 194
Using subprocess concurrency 195
Understanding nix fork concurrency 196
Using thread concurrency 200
Understanding Send and Sync traits 205
Using functional design for concurrency 211
Summary 219
Questions 219
Chapter 9: Performance, Debugging, and Metaprogramming 220
Technical requirements 220
Writing faster code 221
Compiling with release mode 221
Doing less work 222
Optimizing the code that needs it – profiling 223
For a code rarely executed, performance is not affected 223

[ iv ]
Table of Contents

Multiples of small numbers are also small numbers 224


Measuring first, to optimize it 225
Putting the fridge next to the computer 228
Capping the Big O 228
Constanting no growth 229
Logarithmic growth 231
Polynomial growth 232
Exponential growth 234
Referencing data is faster 235
Preventing bugs with defensive coding 237
Using Option and Result instead of panic! 237
Using typesafe interfaces instead of stringly typed interfaces 239
Using the heartbeat pattern for long running processes 240
Validating input and output 241
Finding and fixing bugs 243
Metaprogramming 245
Summary 253
Questions 254
Assessments 255
Other Books You May Enjoy 265
Index 268

[v]
Preface
Thanks for your interest in functional programming in Rust. Rust is a very young
programming language and is particularly new to the functional programming community.
Despite its age, the language provides a wealth of tools that are both practical and
sophisticated.

In this book, we will introduce general functional programming principles and how they
apply to Rust specifically. Our goal is to provide knowledge and a perspective on Rust that
will outlast small changes to language features. The pace of development of Rust is so fast
that during the course of writing the book we introduced new features as they became
available and relevant. We want to equip the reader to produce code for this fast-moving
environment such that they are prepared to best utilize new features as they are released.

Who this book is for


This book is for developers who are familiar with basic Rust features or are willing to
reference other material as they read along. We will not fully explain every new symbol,
library, or syntax form, but we do explain libraries that are considered more advanced or
syntax that may be difficult to read. Similarly, some concepts that are only briefly explained
in the introductory material will be explained in detail.

What this book covers


Chapter 1, Functional Programming – a Comparison, introduces functional programming in
Rust. Comparisons are drawn between functional style and other paradigms that are
prevalent or influential to Rust. The chapter also serves as a brief outline of topics that will
appear later in the book.

Chapter 2, Functional Control Flow, introduces Rust control flow structures while explaining
how they are relevant to the functional style of programming. The expression-centric
nature of functional programming and Rust is illustrated through examples. Limiting as it
may be, the chapter also begins an ongoing project using only the procedural expression
style of programming.
Preface

Chapter 3, Functional Data Structures, introduces the reader to the various, highly
expressive data types available in Rust. Notably, the enum type is introduced, which holds
particular significance in functional programming. The project continues to grow to
incorporate a variety of these data types.

Chapter 4, Generics and Polymorphism, explains the concepts of parameterization of data


(generics) and parameterization of control flow (polymorphism). Parameterization and its
natural interaction with traits reduces the programmer's burden, but the syntax can become
overwhelming. Some approaches to reduce or mitigate parameter explosion are introduced.
The ongoing project again grows to incorporate these features.

Chapter 5, Code Organization and Application Architecture, talks about some architectural
concerns, recommendations, and best practices. Designing and managing the
implementation of a software project is not formulaic. No project is the same, and few are
highly similar, thus no engineering procedure can capture the nuances of software
development. In this chapter, we provide the best tools available, and specifically, the best
that functional programming has to offer.

Chapter 6, Mutability, Ownership, and Pure Functions, digs into some of the more unique
features in Rust. This chapter introduces the concepts of ownership and lifetimes, which are
common stumbling blocks when learning Rust. The functional concepts of immutability
and pure functions are also introduced to help untangle some of the spaghetti that a naive
Rust programmer might generate when attempting to circumvent the rules of ownership in
Rust.

Chapter 7, Design Patterns, lists as many functional programming cheat codes that can fit
into a single chapter. The concept of functors and monads are explained with examples and
some casual definitions. The chapter also briefly introduces the style of functional reactive
programming and uses it to build a quick and dirty web framework.

Chapter 8, Implementing Concurrency, explains how to do multiple things at the same time.
Most of the chapter is spent clarifying the differences and relative strengths and
weaknesses between subprocesses, forked processes, and threads. The Rust thread
concurrency model is then assumed and more information is provided to clarify Rust-
specific logic regarding threads. Toward the end of the chapter, the actor model of
concurrency is introduced, which is a robust model of concurrency that can adapt to most
situations and programming paradigms.

[2]
Preface

Chapter 9, Performance, Debugging, and Metaprogramming, wraps up the book with some
miscellaneous tips for programming in Rust. The performance tips are not particularly
functional, but rather concerned primarily with language-specific details, general advice, or
relevant bits of computer science. Debugging introduces many tips on how to prevent bugs.
Also, how to use an interactive debugger is explained through examples.
Metaprogramming explains precisely how Rust macros and procedural macros work. This
is a great feature of Rust, but is not documented well, so it might be scary to approach.

To get the most out of this book


1. We assume familiarity with the concepts from the first 10 chapters of Rust
documentation (https:/​/​doc.​rust-​lang.​org/​book/​). Some of the material from
these chapters is fairly advanced, so we will also explain that here when relevant.
However, the knowledge of syntax and very basic features will be expected.
2. Clone the GitHub code repository and follow along. Tweak the examples and see
what effects you can create.
3. Stay curious. Some of the keywords we mentioned could fill an entire book with
unique content. Some of these topics presented are so pervasive that they have
decent Wikipedia articles to explain and expand on the concepts. However,
knowing the keyword is required to even know what to search for.

Download the example code files


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

You can download the code files by following these steps:

1. Log in or register at www.packtpub.com.


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

[3]
Preface

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

WinRAR/7-Zip for Windows


Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https:/​/​github.​com/
PacktPublishing/​Hands-​On-​Functional-​Programming-​in-​Rust. In case there's an update
to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available
at https:/​/​github.​com/​PacktPublishing/​. Check them out!

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

CodeInText: Indicates code words in text, database table names, folder names, filenames,
file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an
example: "Let's start by defining some of the type declarations for the physics module."

A block of code is set as follows:


pub trait MotorController
{
fn init(&mut self, esp: ElevatorSpecification, est: ElevatorState);
fn poll(&mut self, est: ElevatorState, dst: u64) -> MotorInput;
}

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


closure may outlive the current function, but it borrows `a`, which is
owned by the current function

Bold: Indicates a new term, an important word, or words that you see onscreen.

Warnings or important notes appear like this.

[4]
Preface

Tips and tricks appear like this.

Get in touch
Feedback from our readers is always welcome.

General feedback: Email feedback@packtpub.com and mention the book title in the
subject of your message. If you have questions about any aspect of this book, please email
us at questions@packtpub.com.

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

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

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

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

For more information about Packt, please visit packtpub.com.

[5]
1
Functional Programming – a
Comparison
Functional programming (FP) is the second most popular programming paradigm, behind
only object-oriented programming (OOP). For many years, these two paradigms have
been separated into different languages, so as not to be mixed. Multi-paradigm languages
have attempted to support both approaches. Rust is one such language.

As a broad definition, functional programming emphasizes the use of composable and


maximally reusable functions to define program behavior. Using these techniques, we will
show how functional programming has adapted clever solutions to many common yet
difficult problems. This chapter will outline most of the concepts presented in this book.
The remaining chapters will be dedicated to helping you master each technique.

The learning outcomes we hope to provide are as follows:

Being able to use functional style to reduce code weight and complexity
Being able to write robust safe code by utilizing safe abstractions
Being able to engineer complex projects using functional principles

Technical requirements
A recent version of Rust is necessary to run the examples provided, and can be found here:
https:/​/​www.​rust-​lang.​org/​en-​US/​install.​html

This chapter's code is also available on GitHub, here:


https:/​/​github.​com/​PacktPublishing/​Hands-​On-​Functional-​Programming-​in-​RUST
Functional Programming – a Comparison Chapter 1

Specific installation and build instructions are also included in each chapter's README.md
file.

Reducing code weight and complexity


Functional programming can greatly reduce the amount and complexity of code required
to accomplish tasks. Particularly in Rust, proper application of functional principles may
simplify the often complex design requirements, and make programming a much more
productive and rewarding experience.

Making generics more generic


Making generics more generic relates to the practice of parameterizing data structures and
functions originated in functional languages. In Rust, and other languages, this is called
generics. Types and functions can all be parameterized. One or more constraints may be
placed on generic types to indicate requirements of a trait or lifetime.

Struct definitions can become redundant without generics. Here is a definition of three
structs that define a common concept of a Point. However, the structs use different
numerical types, so the singular concept is expanded into three separate PointN type
definitions in intro_generics.rs:
struct PointU32
{
x: u32,
y: u32
}

struct PointF32
{
x: f32,
y: f32
}

struct PointI32
{
x: i32,
y: i32
}

[7]
Functional Programming – a Comparison Chapter 1

Instead, we can use generics to remove duplicate code and make the code more robust.
Generic code is more easily adaptable to new requirements because many behaviors (and
thus requirements) can be parameterized. If a change is needed, it is better to only change
one line rather than a hundred.

This code snippet defines a parameterized Point struct. Now, a single definition can
capture all possible numerical types for a Point in intro_generics.rs:
struct Point<T>
{
x: T,
y: T
}

Functions are also problematic without generics.

Here is a simple function to square a number. However, to capture possible numerical


types, we define three different functions in intro_generics.rs:
fn foo_u32(x: u32) -> u32
{
x*x
}

fn foo_f32(x: f32) -> f32


{
x*x
}

fn foo_i32(x: i32) -> i32


{
x*x
}

Function parameters, such as this one, may need trait bounds (a constraint specifying one
or more traits) to permit any behavior on that type that is used in the function body.

Here is the foo function, redefined with a parameterized type. A single function can define
the operation for all numerical types. Explicit bounds must be set for even basic operations,
such as multiply or even copy, in intro_generics.rs:
fn foo<T>(x: T) -> T
where T: std::ops::Mul<Output=T> + Copy
{
x*x
}

[8]
Functional Programming – a Comparison Chapter 1

Even functions can be sent as parameters. We call these higher-order functions.

Here is a trivial function that accepts a function and argument, then calls the function with
the argument, returning the result. Note the trait bound Fn, indicating that the provided
function is a closure. For an object to be callable, it must implement one of the fn, Fn,
FnMut, or FnOnce traits in intro_generics.rs:

fn bar<F,T>(f: F, x: T) -> T
where F: Fn(T) -> T
{
f(x)
}

Functions as values
Functions are nominally the big feature of functional programming. Specifically, functions
as values are the keystone of the whole paradigm. Glossing over much detail, we will also
introduce the term closure here for future reference. A closure is an object that acts as a
function, implementing fn, Fn, FnMut, or FnOnce.

Simple closures can be defined with the built-in closure syntax. This syntax is also
beneficial because the fn, Fn, FnMut, and FnOnce traits are automatically implemented if
permitted. This syntax is great for shorthand manipulation of data.

Here is an iterator over the range 0 to 10, mapped to the squared value. The square
operation is applied using an inline closure definition sent to the map function of the
iterator. The result of this expression will be an iterator. Here is an expression in
intro_functions.rs:

(0..10).map(|x| x*x);

Closures can also have complex bodies with statements if the block syntax is used.

Here is an iterator from 0 to 10, mapped with a complex equation. The closure provided to
map includes a function definition and a variable binding in intro_functions.rs:
(0..10).map(|x| {
fn f(y: u32) -> u32 {
y*y
}
let z = f(x+1) * f(x+2);
z*z
}

[9]
Functional Programming – a Comparison Chapter 1

It is possible to define functions or methods that accept closures as arguments. To use the
closure as a callable function, a bound of Fn, FnMut, or FnOnce must be specified.

Here is a HoF definition accepting a function g and an argument x. The definition


constrains g and x to process u32 types, and defines some mathematical operations
involving calls to g. An invocation of the f HoF is also provided, as follows, using a simple
inline closure definition in intro_functions.rs:
fn f<T>(g: T, x: u32) -> u32
where T: Fn(u32) -> u32
{
g(x+1) * g(x+2)
}

fn main()
{
f(|x|{ x*x }, 2);
}

Many parts of the standard library, particularly iterators, encourage heavy use of functions
as arguments.

Here is an iterator from 0 to 10 followed by many chained iterator combinators.


The map function returns a new value from an original. inspect looks at a value, does not
change it, but permits side-effects. filter omits all values that do not satisfy a predicate.
filter_map filters and maps with a single function. The fold reduces all results to a
single value, starting from an initial value, working left to right. Here is the expression in
intro_functions.rs:

(0..10).map(|x| x*x)
.inspect(|x|{ println!("value {}", *x) })
.filter(|x| *x<3)
.filter_map(|x| Some(x))
.fold(0, |x,y| x+y);

[ 10 ]
Functional Programming – a Comparison Chapter 1

Iterators
Iterators are a common feature of OOP languages, and Rust supports this concept well.
Rust iterators are also designed with functional programming in mind, allowing
programmers to write more legible code. The specific concept emphasized here is
composability. When iterators can be manipulated, transformed, and combined, the mess
of for loops can be replaced by individual function calls. These examples can be found in
the intro_iterators.rs file. This is depicted in the following table:

Function name with description Example


Chain concatenates two iterators:
(0..10).chain(10..20);
first...second
The zip function combines two iterators into
tuple pairs, iterating until the end of the (0..10).zip(10..20);
shortest iterator: (a1,b1), (a2, b2), ...
The enumerate function is a special case
of zip that creates numbered tuples (0, (0..10).enumerate();
a1),(1,a2), …
The inspect function applies a function to all (0..10).inspect(|x|{ println!("value
values in the iterator during iteration {}", *x) });
The map function applies a function to each
(0..10).map(|x| x*x);
element, returning the result in place
The filter function restricts elements to
(0..10).filter(|x| *x<3);
those satisfying a predicate
The fold function accumulates all values into
(0..10).fold(0, |x,y| x+y);
a single result
for i in (0..10) {}
When you want to apply the iterator, you can
use a for loop or call collect
(0..10).collect::<Vec<u64>>();

Compact legible expressions


In functional languages, all terms are expressions. There are no statements in function
bodies, only a single expression. All control flow operators are then formulated as
expressions with a return value. In Rust, this is almost the case; the only non-expressions
are let statements and item declarations.

[ 11 ]
Functional Programming – a Comparison Chapter 1

Both of these statements can be wrapped in blocks to create an expression along with any
other term. An example for this is the following, in intro_expressions.rs:
let x = {
fn f(x: u32) -> u32 {
x * x
}
let y = f(5);
y * 3
};

This nested format is uncommon in the wild, but it illustrates the permissive nature of Rust
grammar.

Returning to the concept of functional style expressions, the emphasis should always be on
writing legible literate code without much hassle or bloat. When someone else, or you at a
later time, comes to read your code, it should be immediately understandable. Ideally, the
code should document itself. If you find yourself constantly writing code twice, once in
code and again as comments, then you should reconsider how effective your programming
practices really are.

To start with some examples of functional expressions, let's look at an expression that exists
in most languages, the ternary conditional operator. In a normal if statement, the
condition must occupy its own line and thus cannot be used as a sub-expression.

The following is a traditional if statement, initializing a variable in


intro_expressions.rs:

let x;
if true {
x = 1;
} else {
x = 2;
}

With the ternary operator, this assignment can be moved to a single line, shown as follows
in intro_expressions.rs:
let x = if true { 1 } else { 2 };

[ 12 ]
Functional Programming – a Comparison Chapter 1

Almost every statement from OOP in Rust is also an expression—if, for, while, and so
on. One of the more unique expressions to see in Rust that is uncommon in OOP languages
is direct constructor expressions. All Rust types can be instantiated by single expressions.
Constructors are only necessary in specific cases, for example, when an internal field
requires complex initialization. The following is a simple struct and an equivalent tuple
in intro_expressions.rs:
struct MyStruct
{
a: u32,
b: f32,
c: String
}

fn main()
{
MyStruct {
a: 1,
b: 1.0,
c: "".to_string()
};

(1, 1.0, "".to_string());


}

Another distinctive expression from functional languages is pattern matching. Pattern


matching can be thought of as a more powerful version of a switch statement. Any
expression can be sent into a pattern expression and de-structured to bind internal
information into local variables before executing a branch expression. Pattern expressions
are uniquely suited for working with enums. The two make a perfect pair.

The following snippet defines a Term as a tagged union of expression options. In the main
function, a Term t is constructed, then matched with a pattern expression. Note the syntax
similarity between the definition of a tagged union and the matching inside of a pattern
expression in intro_expressions.rs:
enum Term
{
TermVal { value: String },
TermVar { symbol: String },
TermApp { f: Box<Term>, x: Box<Term> },
TermAbs { arg: String, body: Box<Term> }
}

fn main()

[ 13 ]
Functional Programming – a Comparison Chapter 1

{
let mut t = Term::TermVar {
symbol: "".to_string()
};
match t {
Term::TermVal { value: v1 } => v1,
Term::TermVar { symbol: v1 } => v1,
Term::TermApp { f: ref v1, x: ref v2 } =>
"TermApp(?,?)".to_string(),
Term::TermAbs { arg: ref mut v1, body: ref mut v2 } =>
"TermAbs(?,?)".to_string()
};
}

Strict abstraction means safe abstraction


Having a stricter type system does not imply that code will have more requirements or be
any more complex. Rather than strict typing, consider using the term expressive typing.
Expressive typing provides more information to the compiler. This extra information
allows the compiler to provide extra assistance while programming. This extra information
also permits a very rich metaprogramming system. This is all in addition to the obvious
benefit of safer, more robust code.

Scoped data binding


Variables in Rust are treated much more strictly than in most other languages. Global
variables are almost entirely disallowed. Local variables are put under close watch to
ensure that allocated data structures are properly deconstructed before going out of scope,
but not sooner. This concept of tracking a variable's proper scope is known as ownership
and lifetime.

In a simple example, data structures that allocate memory will deconstruct automatically
when they go out of scope. No manual memory management is required in
intro_binding.rs:

fn scoped() {
vec![1, 2, 3];
}

[ 14 ]
Functional Programming – a Comparison Chapter 1

In a slightly more complex example, allocated data structures can be passed around as
return values, or referenced, and so on. These exceptions to simple scoping must also be
accounted for in intro_binding.rs:
fn scoped2() -> Vec<u32>
{
vec![1, 2, 3]
}

This usage tracking can get complicated (and undecidable), so Rust has some rules that
restrict when a variable can escape a context. We call this complex rules ownership. It can
be explained with the following code, in intro_binding.rs:
fn scoped3()
{
let v1 = vec![1, 2, 3];
let v2 = v1;
//it is now illegal to reference v1
//ownership has been transferred to v2
}

When it is not possible or desirable to transfer ownership, the clone trait is encouraged to
create a duplicate copy of whatever data is referenced in intro_binding.rs:
fn scoped4()
{
vec![1, 2, 3].clone();
"".to_string().clone();
}

Cloning or copying is not a perfect solution, and comes with a performance overhead. To
make Rust faster, and it is pretty fast, we also have the concept of borrowing. Borrowing is
a mechanism to receive a direct reference to some data with the promise that ownership
will be returned by some specific point. References are indicated by an ampersand.
Consider the following example, in intro_binding.rs:
fn scoped5()
{
fn foo(v1: &Vec<u32>)
{
for v in v1
{
println!("{}", v);
}
}

[ 15 ]
Functional Programming – a Comparison Chapter 1

let v1 = vec![1, 2, 3];


foo(&v1);

//v1 is still valid


//ownership has been returned
v1;
}

Another benefit of strict ownership is safe concurrency. Each binding is owned by a


particular thread, and that ownership can be transferred to new threads with the move
keyword. This has been explained with the following code, in intro_binding.rs:
use std::thread;

fn thread1()
{
let v = vec![1, 2, 3];

let handle = thread::spawn(move || {


println!("Here's a vector: {:?}", v);
});

handle.join().ok();
}

To share information between threads, programmers have two main options.

First, programmers may use the traditional combination of locks and atomic references.
This is explained with the following code, in intro_binding.rs:
use std::sync::{Mutex, Arc};
use std::thread;

fn thread2()
{

let counter = Arc::new(Mutex::new(0));


let mut handles = vec![];

for _ in 0..10 {
let counter = Arc::clone(&counter);
let handle = thread::spawn(move || {
let mut num = counter.lock().unwrap();
*num += 1;
});
handles.push(handle);
}

[ 16 ]
Functional Programming – a Comparison Chapter 1

for handle in handles {


handle.join().unwrap();
}

println!("Result: {}", *counter.lock().unwrap());


}

Second, channels provide a nice mechanism for message passing and job queuing between
threads. The send trait is also implemented automatically for most objects. Consider the
following code, in intro_binding.rs:
use std::thread;
use std::sync::mpsc::channel;

fn thread3() {

let (sender, receiver) = channel();


let handle = thread::spawn(move ||{

//do work
let v = vec![1, 2, 3];
sender.send(v).unwrap();

});

handle.join().ok();
receiver.recv().unwrap();
}

All of this concurrency is type-safe and compiler-enforced. Use threads as much as you
want, and if you accidentally try to create a race condition or simple deadlock, then the
compiler will stop you. We call this fearless concurrency.

Algebraic datatypes
In addition to structs/objects and functions/methods, Rust functional programming
includes some rich additions to definable types and structures. Tuples provide a shorthand
for defining simple anonymous structs. Enums provide a type-safe approach to unions of
complex data structures with the added bonus of a constructor tag to help in pattern
matching. The standard library has extensive support for generic programming, from base
types to collections. Even the object system traits are a hybrid cross between the OOP
concept of a class and the FP concept of type classes. Functional style lurks around every
corner, and even if you don't seek them in Rust, you will probably find yourself
unknowingly using the features.

[ 17 ]
Functional Programming – a Comparison Chapter 1

The type aliases can be helpful to create shorthand names for complex types. Alternatively,
the newtype struct pattern can be used to create an alias with different non-equivalent
types. Consider the following example, in intro_datatypes.rs:
//alias
type Name = String;

//newtype
struct NewName(String);

A struct, even when parameterized, can be repetitive when used simply to store multiple
values into a single object. This can be seen in intro_datatypes.rs:
struct Data1
{
a: i32,
b: f64,
c: String
}

struct Data2
{
a: u32,
b: String,
c: f64
}

A tuple helps eliminate redundant struct definitions. No prior type definitions are
necessary to use tuples. Consider the following example, in intro_datatypes.rs:
//alias to tuples
type Tuple1 = (i32, f64, String);
type Tuple2 = (u32, String, f64);

//named tuples
struct New1(i32, f64, String);
struct New2(u32, String, f64);

Standard operators can be implemented for any type by implementing the correct
trait. Consider the following example for this, in intro_datatypes.rs:
use std::ops::Mul;

struct Point
{
x: i32,
y: i32

[ 18 ]
Another Random Scribd Document
with Unrelated Content
boatman said was the only thing, and the thing indispensable. I tasted of it—and truly
it had not the usual odious taste of our American whiskey!

We quote these passages merely as specimens of the singular


simplicity—more properly naiveté—which is the prevailing feature of
the book.

Mr. Dewey left New York for England on the 8th June 1833, and
arrived in St. George's channel on the 24th of the same month,
having a fair wind and smooth sea during the entire passage.
Leaving England, he visited Wales, Ireland, Scotland, France,
Belgium, Prussia, Switzerland, and Italy. Returning by way of
Liverpool, he reached home on the 22d of May, 1834.

RICHARDSON'S DICTIONARY.

A New Dictionary of the English Language: By Charles Richardson.


London: William Pickering—New York: William Jackson.

The periodical nature of this publication absolves us from what


would otherwise be a just charge of neglect in not speaking of it
sooner. Five numbers have been issued, and twenty-five more are to
be added, at intervals of a fortnight. These numbers are of quarto
form, and contain eighty pages in triple columns. The paper is
excellent, and the matter beautifully stereotyped. The whole will
form, when the publication is completed, two very large quarto
volumes, of which the entire cost will have been fifteen dollars. We
say when the publication is completed—the work itself is already so
—a consideration of great importance, and sure to be appreciated by
the thousands of subscribers to the many costly periodicals which
have failed in completing their issue, and thus thrown a number of
odd volumes upon the hands of the public. In what farther we have
to say of this Dictionary, we shall do little more than paraphrase the
very satisfactory prospectus of Mr. Richardson himself.
When Dr. Johnson, in 1747, announced his intention of writing a
Dictionary of the English language, he communicated the plan of his
undertaking in a letter to Lord Chesterfield. The plan was as follows.
He would give, first—the natural and primitive meaning of words;
secondly, the consequential—and thirdly the metaphorical, arranging
the quotations chronologically. The book, however, was published in
1755, without the plan, and strange to say, in utter disregard of the
principles avowed in the letter to the Earl of Chesterfield. That these
principles were well-conceived, and that if followed out, they would
have rendered important service to English lexicography, was not
doubted at the time, and cannot be doubted now. Moreover, the
necessity for something of the kind which was felt then, is more
strongly felt now, for no person has as yet attempted to construct a
work upon the plan proposed, and the difficulties which were to
have been remedied, are greatly aggravated by time. Eighty years
have passed, and not only has no new work been written upon the
plan of Dr. Johnson—but no systematic work of reform upon the old
basis.

The present Dictionary of Mr. Richardson is, distinctly, a new work,


upon a system never attempted before—upon the principles of
Horne Tooke, the greatest of philosophical grammarians, and whose
developments of an entirely novel theory of language have excited
the most profound interest and respect in the minds of all who think.

In the Diversions of Purley, it is positively demonstrated that a word


has one meaning and one only, and that from this one meaning all
the usages of the word must spring. “To discover this meaning,” says
Mr. Richardson, “etymological research was indispensable, and I
have stated the results of such research with conciseness, it is true,
yet with a fullness that will enable the more learned reader to form a
judgment for himself, and the path of deeper investigation is
disclosed to the pursuit of the curious inquirer.” In tracing the usages
of words, Mr. R. has availed himself of the materials collected by
Johnson and his editors, “the various supplements and provincial
vocabularies, the notes of editors and commentators upon our older
poets, and of abundant treasures amassed for his own peculiar use.”
The quotations are arranged chronologically, and embrace extracts
from the earliest to the latest writers of English. The etymology is
placed distinctly by itself for the convenience of hasty reference. As
an example of the arrangement of the work, we will give the word
Calefy.

CA´LEFY
Lat. Calefieri, to be or become hot.
CALEFA´CTION }
Calere, Vossius deduces from the Doric
CALI´DITY
Καλεος for Κηλεος, burning.
CA´LIDUCT
To heat, to be, become, or cause to be hot.

But crystal will calefie into electricity; that is, a power to attract straws or light bodies
and convert the needle freely placed.—Brown. Vulgar Errours, b. ii. c. 1.

As [if] the remembrance of calefaction can warm a man in a cold frosty night.—More.
Philos. Poems, c. 2, Pref.

But ice will dissolve in any way of heat; for it will dissolve with fire; it will colliquate in
water, or warm oyl; nor doth it onely submit unto an actual heat, but not endure the
potential calidity of many waters.—Brown. Vulgar Errours. b. ii. c. 1.

Since the subterranean caliducts have been introduced. Evelyn.

In his prospectus, Mr. Richardson has had occasion to speak in no


measured terms of the Dictionary of Dr. Webster. We here repeat his
observations because we think them entirely just.
The author is conscious that he should be chargeable with great want of courtesy if
he passed unnoticed the American Dictionary of Dr. Webster. His censure however
must be short. Dr. Webster disarmed and stripped himself for the field, and advanced
unaided and unshielded to the combat. He abjured the assistance of Skinner and
Vossius, and the learned elders of lexicography; and of Tooke he quaintly says, ‘I
have made no use of his writings.’ There is a display of oriental reading in his
Preliminary Essays, which as introductory to a Dictionary of the English Language,
seems as appropriate and useful as a reference to the code of Gentoo laws to decide
a question of English inheritance. Dr. Webster was entirely unacquainted with our old
authors.

We believe the North American Review has remarked of the work


before us, that its definitions are in some measure too scanty, and
not sufficiently compact. This defect, which cannot altogether be
denied, and which is, to say the truth, of more importance to the
mass of readers than to the philologist, will be found, upon
examination, a defect inseparable from the plan originally proposed,
and which insists upon an arrangement of derivatives under
primitives. We are not tempted, however, to wish any modification of
the principal design, for the sake of a partial, and not very important
amendment.

We conclude in heartily recommending the work of Mr. Richardson to


the attention of our readers. It embraces we think, every
desideratum in an English Dictionary, and has moreover a thousand
negative virtues. Messrs. Mayo and Davis are the agents in
Richmond.

BOOK OF GEMS.

The Book of Gems. The Poets and Artists of Great Britain. Edited by
S. C. Hall. London and New York: Saunders and Otley.
This work combines the rich embellishments of the very best of the
race of Annuals, with a far higher claim to notice than any of them in
its strictly literary department. If we regard this volume as the only
one to appear, the title will convey no idea of the design—but we are
promised a continuation. The whole, if we comprehend, will contain
specimens of all the principal poets and artists of Great Britain. In
the present instance we have the poets as far as Prior, including a
period of about four hundred years, with extracts from Chaucer,
Lydgate, James I, Hawes, Carew, Quarles, Shirley, Habington,
Lovelace, Wyatt, Surrey, Sackville, Vere, Gascoigne, Raleigh,
Spenser, Sidney, Brooke, Southwell, Daniel, Drayton, Shakspeare,
Walton, Davies, Donne, Jonson, Corbet, Phineas Fletcher, Giles
Fletcher, Drummond, Wither, Carew, Browne, Herrick, Quarles,
Herbert, Davenant, Waller, Milton, Suckling, Butler, Crashaw,
Denham, Cowley, Marvell, Dryden, Roscommon, Dorset, Sedley,
Rochester, Sheffield, and Prior. Of these, all the autographs have
been obtained and are published collectively at the end of the book,
with the exception of the nine first mentioned. The work is
illustrated by fifty-three engravings, each by different artists. A sea-
side group by Harding, and L'Allegro and Il Penseroso by Parris, are
particularly good—but all are excellent.

We had prepared some observations in regard to the book itself,


(over which we have been poring for many days with intense
delight) and in regard more especially to the character and justice of
that deep feeling with which most men, having claim to taste, are
wont to look, even through a veil of exceedingly troublesome
obscurity and antiquity, upon the writings of the elder poets and
dramatists of Great Britain. But we have been so nearly anticipated
in our design by a paper in the American Monthly Magazine for July,
that what we should now say, and say con amore, would be looked
upon as little better than a rifacimento of the article we mention. At
the same time it would be an ill deed to remodel our thoughts, and
proceed to think falsely, for the mere purpose of proving that we can
think originally. In this dilemma then, we will merely express our
general accordance in the opinions of the Northern Magazine, copy,
of its critique, a portion which seems to embody, in little compass,
much of what we have said less forcibly and more diffusely, and add
some few additional observations which have lately suggested
themselves.

“Among the early English poets, so called,” says the American


Monthly, “there is combined with marked individuality, a sort of
general resemblance, not easily defined, but readily perceived by a
discriminating reader. They lived in an age of invention, and wrote
from a pleasurable impulse which they could not resist. They did not
borrow from one another, or from those who had gone before them,
nor pass their time in pouring from one vessel into another. Thus,
however different their styles, however various their subjects,
whether the flight of their genius be high or low, there is the same
aspect of truth and naturalness in the poetry of them all; as we can
trace a common likeness in all faces which have an open, ingenuous
expression, however little resemblance there may be in the several
features. Most of them were well acquainted with books, and many
of them were deeply learned; and an air of ripe scholarship
sometimes degenerating into pedantry, pervades every thing they
wrote. As a class too, they are remarkable for a healthy, intellectual
tone, defaced neither by moody misanthropy, nor mawkish
sentimentality. The manly Saxon character beams out from every
line; and that vigorous good sense, so characteristic of the English
stock, every where leaves its impress. Another trait which, with a
few exceptions, honorably distinguishes them, is the purity of their
sentiments, and their high moral feeling, especially in all that
touches the relation of the sexes. We shall find many coarse
expressions, such as a man would not read aloud to his family; but
very rarely any thing bordering upon heartless profligacy, or studied
licentiousness, or any intimation of a want of respect for the great
principles of the moral law. Due reverence is always shown for those
high personal qualities which constitute the best security for the
greatness and prosperity of a people. Homage is always paid to
honor in man, and chastity in woman. The passion of love, in its
multitudinous forms and aspects, supplies a large proportion of their
themes, and it is treated with equal delicacy and beauty. In the
amatory strains of the old English poets, we perceive a romantic
self-forgetfulness, an idealization of the beloved object, a tenderness
and respectfulness of feeling, in which the passion is almost wholly
swallowed up in the sentiment, and a wooing with the best treasures
of the intellect as well as the heart, such as can be found in no other
class of poets.”

Notwithstanding the direct truth of what has been here so well


advanced, it cannot, we think, be a matter of doubt with any
reflecting mind, that at least one-third of the reverence, or of the
affection, with which we regard the elder poets of Great Britain,
should be credited to what is, in itself, a thing apart from poetry—we
mean to the simple love of the antique—and that again a third of
even the proper poetic sentiment inspired by these writings should
be ascribed to a fact which, while it has a strict connection with
poetry in the abstract, and also with the particular poems in
question, must not be looked upon as a merit appertaining to the
writers of the poems. Almost every devout reader of the old English
bards, if demanded his opinion of their productions, would mention
vaguely, yet with perfect sincerity, a sense of dreamy, wild,
indefinite, and he would perhaps say, undefinable delight. Upon
being required to point out the source of this so shadowy pleasure,
he would be apt to speak of the quaint in phraseology and of the
grotesque in rhythm. And this quaintness and grotesqueness are, as
we have elsewhere endeavored to show, very powerful, and if well
managed, very admissible adjuncts to Ideality. But in the present
instance they arise independently of the author's will, and are
matters altogether apart from his intention. The American Monthly
has forcibly painted the general character of the old English Muse.
She was a maid, frank, guileless, and perfectly sincere, and although
very learned at times, still very learned without art. No general error
evinces a more thorough confusion of ideas than the error of
supposing Donne and Cowley metaphysical in the sense wherein
Wordsworth and Coleridge are so. With the two former ethics were
the end—with the two latter the means. The poet of the Creation
wished, by highly artificial verse, to inculcate what he considered
moral truth—he of the Auncient Mariner to infuse the Poetic
Sentiment through channels suggested by mental analysis. The one
finished by complete failure what he commenced in the grossest
misconception—the other, by a path which could not possibly lead
him astray, arrived at a certainty and intensity of triumph which is
not the less brilliant and glorious because concentrated among the
very few who have the power to perceive it. It will now be seen that
even the “metaphysical verse” of Cowley is no more than evidence
of the straight-forward simplicity and single-heartedness of the man.
And he was in all this but a type of his school—for we may as well
designate in this way the entire class of writers whose poems are
bound up in the volume before us, and throughout all of whom runs
a very perceptible general character. They used but little art in
composition. Their writings sprang immediately from the soul—and
partook intensely of the nature of that soul. It is not difficult to
perceive the tendency of this glorious abandon. To elevate
immeasurably all the energies of mind—but again—so to mingle the
greatest possible fire, force, delicacy, and all good things, with the
lowest possible bathos, baldness, and utter imbecility, as to render it
not a matter of doubt, but of certainty, that the average results of
mind in such a school, will be found inferior to those results in one
(ceteris paribus) more artificial. Such, we think, is the view of the
older English Poetry, in which a very calm examination will bear us
out. The quaintness in manner of which we were just speaking, is an
adventitious advantage. It formed no portion of the poet's intention.
Words and their rhythm have varied. Verses which affect us to day
with a vivid delight, and which delight in some instances, may be
traced to this one source of grotesqueness and to none other, must
have worn in the days of their construction an air of a very common-
place nature. This is no argument, it will be said, against the poems
now. Certainly not—we mean it for the poets then. The notion of
power, of excessive power, in the English antique writers should be
put in its proper light. This is all we desire to see done.
We cannot bring ourselves to believe that the selections made use of
in the Book of Gems, are such as will impart to a poetical reader the
highest possible idea of the beauty of the school. Better extracts
might be made. Yet if the intention were merely to show the
character of the school the attempt is entirely successful. There are
long passages now before us of the most utterly despicable trash,
with no merit whatever beyond their simple antiquity. And it is
almost needless to say that there are many passages too of a
glorious strength—a radiant loveliness, making the blood tingle in
our veins as we peruse them. The criticisms of the Editor do not
please us in a great degree. He seems to have fallen into the
common cant in such cases. In one instance the American Monthly
accords with him in an unjust opinion touching some verses by Sir
Henry Wotton, on the Queen of Bohemia, daughter of James I, and
about which it is said that “there are few finer things in our
language.” Our readers will agree with us, we believe, that this
praise is exaggerated. We quote the lines in full.
You meaner beauties of the night
That poorly satisfy our eyes,
More by your number than your light,
You common people of the skies
What are you when the sun shall rise?

You curious chaunters of the wood


That warble forth dame Nature's lays,
Thinking your passions understood
By your weak accents; what's your praise
When Philomel her voice shall raise?

You violets, that first appear


By your pure purple mantles known,
Like the proud virgins of the year
As if the spring were all your own,
What are you when the rose is blown?

So, when my mistress shall be seen


In sweetness of her looks and mind,
By virtue first, then choice a queen,
Tell me if she were not designed
Th' eclipse and glory of her kind?

In such lines we can perceive not one of those higher attributes of


the Muse which belong to her under all circumstances and
throughout all time. Here everything is art—naked or but awkwardly
concealed. No prepossession for the mere antique (for in this case
we can imagine no other prepossession) should induce us to dignify
with the sacred name of Poesy, a series such as this, of elaborate
and threadbare compliments, (threadbare even at the time of their
composition) stitched apparently together, without fancy, without
plausibility, without adaptation of parts—and it is needless to add,
without a jot of imagination.
We have been much delighted with the Shepherd's Hunting, by
Wither—a poem partaking, in a strange degree, of the peculiarities
of the Penseroso. Speaking of Poesy he says—

By the murmur of a spring


Or the least boughs rusteling,
By a daisy whose leaves spread
Shut when Tytan goes to bed,
Or a shady bush or tree
She could more infuse in me
Than all Nature's beauties can
In some other wiser man.
By her help I also now
Make this churlish place allow
Something that may sweeten gladness
In the very gall of sadness—
The dull loneness, the black shade
That these hanging vaults have made,
The strange music of the waves
Beating on these hollow caves,
This black den which rocks emboss
Overgrown with eldest moss,
The rude portals that give light
More to terror than delight,
This my chamber of neglect
Walled about with disrespect—
From all these and this dull air
A fit object for despair,
She hath taught me by her might
To draw comfort and delight.

But these verses, however good, do not bear with them much of the
general character of the English antique. Something more of this will
be found in the following lines by Corbet—besides a rich vein of
humor and sarcasm.
Farewell rewards and fairies!
Good housewives now you may say,
For now foul sluts in dairies
Do fare as well as they:
And though they sweep their hearths no less
Than maids were wont to do,
Yet who of late for cleanliness
Finds sixpence in her shoe?

Lament, lament, old Abbies,


The fairies' lost command,
They did but change priests' babies,
But some have changed your land;
And all your children stolen from thence
Are now grown Puritanes,
Who live as changelings ever since
For love of your demaines.

At morning and at evening both


You merry were and glad,
So little care of sleep and sloth
These pretty ladies had:
When Tom came home from labor
Or Ciss to milking rose,
Then merrily went their tabor
And nimbly went their toes.

Witness those rings and roundelays


Of theirs which yet remain,
Were footed in Queen Mary's days
On many a grassy plain;
But since of late Elizabeth
And later James came in,
They never danced on any heath
As when the time hath bin.
The Maiden lamenting
By which for
we her
note Fawn , by Marvell, is, we are pleased
the fairies
to see, a favorite with
Were ofour
the friends of the American Monthly. Such
old profession,
portion of it as we now
Their copy,
songs we Marys,
were Ave prefer not only as a specimen of
the elder poets, but,Their
in itself, as aprocession;
dances were beautiful poem, abounding in the
sweetest pathos, But
in soft and
now alas gentle
they images, in the most exquisitely
all are dead
delicate imagination,Orand
gonein truththe
beyond —to any thing of its species.
seas,
Or farther for religion fled—
Or else they take their ease.

A tell-tale in their company


They never could endure,
And whoso kept not secretly
Their mirth was punished sure;
It was a just and christian deed
To pinch such black and blue—
O how the commonwealth doth need
Such justices as you!

Now they have left our quarters


A register they have,
Who can preserve their charters—
A man both wise and grave.
An hundred of their merry pranks
By one that I could name
Are kept in store; con twenty thanks
To William for the same.

To William Churne of Staffordshire


Give laud and praises due,
Who every meal can mend your cheer
With tales both old and true.
To William all give audience
And pray you for his noddle,
For all the fairies evidence
Were lost if it were addle.
It is a wondrous thing how fleet
'Twas on those little silver feet,
With what a pretty skipping grace
It oft would challenge me the race,
And when 't had left me far away
'Twould stay and run again and stay;
For it was nimbler much than hinds,
And trod as if on the four winds.
I have a garden of my own,
But so with roses overgrown,
And lilies that you would it guess
To be a little wilderness,
And all the spring-time of the year
It only loved to be there.
Among the beds of lilies I
Have sought it oft where it should lie,
Yet could not till itself would rise
Find it although before mine eyes.
For in the flaxen lilies shade,
It like a bank of lilies laid,
Upon the roses it would feed
Until its lips even seemed to bleed,
And then to me 'twould boldly trip,
And print those roses on my lip,
But all its chief delight was still
On roses thus itself to fill,
And its pure virgin limbs to fold
In whitest sheets of lilies cold.
Had it lived long it would have been
Lilies without, roses within.

How truthful an air of deep lamentation hangs here upon every


gentle syllable! It pervades all. It comes over the sweet melody of
the words, over the gentleness and grace which we fancy in the little
maiden herself, even over the half-playful, half-petulant air with
which she lingers on the beauties and good qualities of her favorite
—like the cool shadow of a summer cloud over a bed of lilies and
violets, and “all sweet flowers.”

The whole thing is redolent with poetry of the very loftiest order. It
is positively crowded with nature and with pathos. Every line is an
idea—conveying either the beauty and playfulness of the fawn, or
the artlessness of the maiden, or the love of the maiden, or her
admiration, or her grief, or the fragrance and sweet warmth, and
perfect appropriateness of the little nestlike bed of lilies and roses,
which the fawn devoured as it lay upon them, and could scarcely be
distinguished from them by the once happy little damsel who went
to seek her pet with an arch and rosy smile upon her face. Consider
the great variety of truth and delicate thought in the few lines we
have quoted—the wonder of the maiden at the fleetness of her
favorite—the “little silver feet”—the fawn challenging his mistress to
the race, “with a pretty skipping grace,” running on before, and then,
with head turned back, awaiting her approach only to fly from it
again—can we not distinctly perceive all these things? The exceeding
vigor, too, and beauty of the line

And trod as if on the four winds,

which are vividly apparent when we regard the artless nature of the
speaker, and the four feet of the favorite—one for each wind. Then
the garden of “my own,” so overgrown—entangled—with lilies and
roses as to be “a little wilderness”—the fawn loving to be there and
there “only”—the maiden seeking it “where it should lie,” and not
being able to distinguish it from the flowers until “itself would rise”—
the lying among the lilies “like a bank of lilies”—the loving to “fill”
itself with roses,

And its pure virgin limbs to fold


In whitest sheets of lilies cold,

and these things being its “chief” delights—and then the pre-
eminent beauty and naturalness of the concluding lines—whose very
outrageous hyperbole and absurdity only render them the more true
to nature and to propriety, when we consider the innocence, the
artlessness, the enthusiasm, the passionate grief, and more
passionate admiration of the bereaved child.

Had it lived long it would have been


Lilies without—roses within.

SOUTH-SEA EXPEDITION.

Report of the Committee on Naval Affairs, to whom was referred


memorials from sundry citizens of Connecticut interested in the
whale fishing, praying that an exploring expedition be fitted out to
the Pacific Ocean and South Seas. March 21, 1836.

That a more accurate, defined, and available knowledge than we at


present possess, of the waters, islands, and continental coasts of the
great Pacific and Southern Oceans, has long been desirable, no
unprejudiced individual conversant with the subject, is likely to deny.
A portion of the community unrivalled in activity, enterprise and
perseverance, and of paramount importance both in a political and
commercial point of view, has long been reaping a rich harvest of
individual wealth and national honor in these vast regions. The
Pacific may be termed the training ground, the gymnasium of our
national navy. The hardihood and daring of that branch of our
commercial marine employed in its trade and fisheries, have almost
become a proverb. It is in this class we meet with the largest
aggregate of that cool self-possession, courage, and enduring
fortitude, which have won for us our enviable position among the
great maritime powers; and it is from this class we may expect to
recruit a considerable proportion of the physical strength and moral
intelligence necessary to maintain and improve it. The documentary
evidence upon which the report before us is based, forms an
appendix to it, and is highly interesting in its character. It awakens
our admiration at the energy and industry which have sustained a
body of daring men, while pursuing a dangerous and arduous
occupation, amid the perils and casualties of an intricate navigation,
in seas imperfectly known. It enlists our sympathies in the hardships
and difficulties they have combatted, places in strong relief the
justice of their claims upon the nation for aid and protection, and
shows the expediency of the measure which has at last resulted
from their representations. The report itself is clear, manly, decided—
the energetic language of men who, having examined the data
submitted to them with the consideration the interests it involved
seemed to require, are anxious to express their sentiments with a
force and earnestness suited to their views of the urgent occasion
and of the course they recommend.

It is a glorious study to contemplate the progress made by human


industry, from stage to stage, when engaged in the prosecution of a
laudable object. Little more than a century ago, only the crews of a
few miserable open boats, too frail to venture far from land, waged
a precarious warfare with the great leviathans of the deep, along the
shores of Cape Cod and Nantucket—then occupied, at distant
intervals, by a few inconsiderable fishing stations. The returns even
of these first efforts were lucrative, and more appropriate vessels for
the service were fitted out. These extended their cruises northward
to Labrador, and southward to the West Indies. At length the
adventurers, in vessels of yet greater capacity, strength and
durability, crossed the Equator and followed their hardy calling along
the Eastern Shore of the Southern Peninsula and on the Western
and North Western coast of Africa. The Revolution of course
operated as a temporary check to their prosperity, but shortly
thereafter these dauntless mariners doubled Cape Horn, and
launched their daring keels into the comparatively unknown waste
beyond, in search of their gigantic prey. Since that fortunate advent,
the increase in the shipping, extent, and profits of the fishery, has
been unprecedented, and new sources of wealth the importance of
which it is at present impossible to estimate, have been opened to
us in the same quarter. The trade in skins of the sea-otter and seal,
in the fur of land animals on the North West coast, &c. has been
extensive in extent and avails. The last mentioned animal, besides
the valuable ivory it affords, yields a coarse oil which, in the event of
the whale becoming extinct before the perpetual warfare of man,
would prove a valuable article of consumption. Of the magnitude of
the commercial interest involved in different ways in the Pacific
trade, an idea may be gathered in the following extract from the
main subject of our review. Let it be borne in mind, that many of the
branches of this trade are as yet in their infancy, that the natural
resources to which they refer are apparently almost inexhaustible;
and we shall become aware that all which is now in operation, is but
as a dim shadow to the mighty results which may be looked for,
when this vast field for national enterprise is better known and
appreciated.

“No part of the commerce of this country is more important than that carried on in
the Pacific Ocean. It is large in amount. Not less than $12,000,000 are invested in
and actively employed by one branch of the whale fishery alone; in the whole trade
there is directly and indirectly involved not less than fifty to seventy millions of
property. In like manner from 170 to 200,000 tons of our shipping, and from 9 to
12000 of our seamen are employed, amounting to about one-tenth of the whole
navigation of the Union. Its results are profitable. It is to a great extent not a mere
exchange of commodities, but the creation of wealth by labor from the ocean. The
fisheries alone produce at this time an annual income of from five to six millions of
dollars; and it is not possible to look at Nantucket, New Bedford, New London, Sag
Harbor and a large number of other districts upon our Northern coasts, without the
deep conviction that it is an employment alike beneficial to the moral, political, and
commercial interests of our fellow-citizens.”

In a letter from Commodore Downes to the Honorable John Reed,


which forms part of the supplement to the report, that experienced
officer observes—

“During the circumnavigation of the globe, in which I crossed the equator six times,
and varied my course from 40 deg. North to 57 deg. South latitude, I have never
found myself beyond the limits of our commercial marine. The accounts given of the
dangers and losses to which our ships are exposed by the extension of our trade into
seas but little known, so far, in my opinion from being exaggerated, would admit of
being placed in bolder relief, and the protection of government employed in stronger
terms. I speak from practical knowledge, having myself seen the dangers and
painfully felt the want of the very kind of information which our commercial interests
so much need, and which, I suppose, would be the object of such an expedition as is
now under consideration before the committee of Congress to give.

* * * * *

“The commerce of our country has extended itself to remote parts of the world, is
carried on around islands and reefs not laid down in the charts, among even groups
of islands from ten to sixty in number, abounding in objects valuable in commerce,
but of which nothing is known accurately; no not even the sketch of a harbor has
been made, while of such as are inhabited our knowledge is still more imperfect.”

In reading this evidence (derived from the personal observation of a


judicious and experienced commander) of the vast range of our
commerce in the regions alluded to, and of the imminent risks and
perils to which those engaged in it are subjected, it cannot but
create a feeling of surprise, that a matter of such vital importance as
the adoption of means for their relief, should so long have been held
in abeyance. A tabular view of the discoveries of our whaling
captains in the Pacific and Southern seas, which forms part of
another document, seems still further to prove the inaccuracy and
almost utter worthlessness of the charts of these waters, now in use.

Enlightened liberality is the truest economy. It would not be difficult


to show, that even as a matter of pecuniary policy the efficient
measures at length in progress to remedy the evils complained of by
this portion of our civil marine, are wise and expedient. But let us
take higher ground. They were called for—Firstly: as a matter of
public justice. Mr. Reynolds, in his comprehensive and able letter to
the chairman of the committee on Naval Affairs, dated 1828, which,
with many other conclusive arguments and facts furnished by that
gentleman, forms the main evidence on which the late committee
founded their report—observes, with reference to the Pacific;

“To look after our merchant there—to offer him every possible facility—to open new
channels for his enterprise, and to keep up a respectable naval force to protect him—
is only paying a debt we owe to the commerce of the country: for millions have
flowed into the treasury from this source, before one cent was expended for its
protection.”

So far, then, we have done little as a nation to facilitate, or increase,


the operations of our commerce in the quarter indicated; we have
left the adventurous merchant and the hardy fisherman, to fight
their way among reefs of dangerous rocks, and through the channels
of undescribed Archipelagos, almost without any other guides than
their own prudence and sagacity; but we have not hesitated to
partake of the fruits of their unassisted toils, to appropriate to
ourselves the credit, respect and consideration their enterprise has
commanded, and to look to their class as the strongest support of
that main prop of our national power,—a hardy, effective, and well
disciplined national navy.

Secondly. Our pride as a vigorous commercial empire, should


stimulate us to become our own pioneers in that vast island-studded
ocean, destined, it may be, to become, not only the chief theatre of
our traffic, but the arena of our future naval conflicts. Who can say,
viewing the present rapid growth of our population, that the Rocky
Mountains shall forever constitute the western boundary of our
republic, or that it shall not stretch its dominion from sea to sea.
This may not be desirable, but signs of the times render it an event
by no means without the pale of possibility.

The intercourse carried on between the Pacific islands and the coast
of China, is highly profitable, the immense returns of the whale
fishery in the ocean which surrounds those islands, and along the
continental coasts, have been already shown. Our whalers have
traversed the wide expanse from Peru and Chili on the west, to the
isles of Japan on the east, gathering national reverence, as well as
individual emolument, in their course; and yet until the late
appropriation, Congress has never yielded them any pecuniary
assistance, leaving their very security to the scientific labors of
countries far more distant, and infinitely less interested, than our
own.

Thirdly. It is our duty, holding as we do a high rank in the scale of


nations, to contribute a large share to that aggregate of useful
knowledge, which is the common property of all. We have
astronomers, mathematicians, geologists, botanists, eminent
professors in every branch of physical science—we are
unincumbered by the oppression of a national debt, and are free
from many other drawbacks which fetter and control the measures
of the trans-Atlantic governments. We possess, as a people, the
mental elasticity which liberal institutions inspire, and a treasury
which can afford to remunerate scientific research. Ought we not,
therefore, to be foremost in the race of philanthropic discovery, in
every department embraced by this comprehensive term? Our
national honor and glory which, be it remembered, are to be
“transmitted as well as enjoyed,” are involved. In building up the
fabric of our commercial prosperity, let us not filch the corner stone.
Let it not be said of us, in future ages, that we ingloriously availed
ourselves of a stock of scientific knowledge, to which we had not
contributed our quota—that we shunned as a people to put our
shoulder to the wheel—that we reaped where we had never sown. It
is not to be controverted that such has been hitherto the case. We
have followed in the rear of discovery, when a sense of our moral
and political responsibility should have impelled us in its van. Mr.
Reynolds, in a letter to which we have already referred, deprecates
this servile dependence upon foreign research in the following
nervous and emphatic language.

The commercial nations of the earth have done much, and much remains to be
accomplished. We stand a solitary instance among those who are considered
commercial, as never having put forth a particle of strength or expended a dollar of
our money, to add to the accumulated stock of commercial and geographical
knowledge, except in partially exploring our own territory.

When our naval commanders and hardy tars have achieved a victory on the deep,
they have to seek our harbors, and conduct their prizes into port by tables and charts
furnished perhaps by the very people whom they have vanquished.

Is it honorable in the United States to use, forever, the knowledge furnished by


others, to teach us how to shun a rock, escape a shoal, or find a harbor; and add
nothing to the great mass of information that previous ages and other nations have
brought to our hands.

* * * * *

The exports, and, more emphatically, the imports of the United States, her receipts
and expenditures, are written on every pillar erected by commerce on every sea and
in every clime; but the amount of her subscription stock to erect those pillars and for
the advancement of knowledge is no where to be found.

* * * * *

Have we not then reached a degree of mental strength, which will enable us to find
our way about the globe without leading-strings? Are we forever to take the highway
others have laid out for us, and fixed with mile-stones and guide boards? No: a time
of enterprise and adventure must be at hand, it is already here; and its march is
onward, as certain as a star approaches its zenith.

It is delightful to find that such independent statements and opinions


as the above, have been approved, and acted upon by Congress,
and that our President with a wisdom and promptitude which do him
honor, is superintending and facilitating the execution of legislative
design. We extract the following announcement from the
Washington Globe.

Surveying and Exploring Expedition to the Pacific Ocean and South Seas.—We learn
that the President has given orders to have the exploring vessels fitted out, with the
least possible delay. The appropriation made by Congress was ample to ensure all the
great objects contemplated by the expedition, and the Executive is determined that
nothing shall be wanting to render the expedition in every respect worthy the
character and great commercial resources of the country.

The frigate Macedonian, now undergoing thorough repairs at Norfolk, two brigs of
two hundred tons each, one or more tenders, and a store ship of competent
dimensions, is, we understand, the force agreed upon, and to be put in a state of
immediate preparation.

Captain Thomas A. C. Jones, an officer possessing many high qualities for such a
service, has been appointed to the command; and officers for the other vessels will
be immediately selected.

The Macedonian has been chosen instead of a sloop of war, on account of the
increased accommodations she will afford the scientific corps, a department the
President has determined shall be complete in its organization, including the ablest
men that can be procured, so that nothing within the whole range of every
department of natural history and philosophy shall be omitted. Not only on this
account has the frigate been selected, but also for the purpose of a more extended
protection of our whalemen and traders; and to impress on the minds of the natives a
just conception of our character, power, and policy. The frequent disturbances and
massacres committed on our seamen by the natives inhabiting the islands in those
distant seas, make this measure the dictate of humanity.

We understand also, that to J. N. Reynolds, Esq. the President has given the
appointment of Corresponding Secretary to the expedition. Between this gentleman
and Captain Jones there is the most friendly feeling and harmony of action. The
cordiality they entertain for each other, we trust will be felt by all, whether citizen or
officer, who shall be so fortunate as to be connected with the expedition.

Thus it will be seen, steps are being taken to remove the reproach of
our country alluded to by Mr. Reynolds, and that that gentleman has
been appointed to the highest civil situation in the expedition; a
station which we know him to be exceedingly well qualified to fill.
The liberality of the appropriation for the enterprise, the strong
interest taken by our energetic chief magistrate in its organization,
the experience and intelligence of the distinguished commander at
its head, all promise well for its successful termination. Our most
cordial good wishes will accompany the adventure, and we trust that
it will prove the germ of a spirit of scientific ambition, which,
fostered by legislative patronage and protection, shall build up for us
a name in nautical discovery commensurate with our moral, political,
and commercial position among the nations of the earth.

ELKSWATAWA.

Elkswatawa; or the Prophet of the West. A Tale of the Frontier. New


York: Harper and Brothers.

This novel is written by Mr. James S. French, of Jerusalem, Virginia—


the author, we believe, of “Eccentricities of David Crockett,” a book
of which we know nothing beyond the fact of its publication. The
plot of Elkswatawa is nearly as follows. About the period when
rumors were abroad in our frontier settlements, and elsewhere, of
contemplated hostilities by the Indians under Tecumseh, one Mr.
Richard Rolfe, “a high-toned and chivalrous Virginian,” is a resident
of Petersburg. He is left an orphan in early life—is educated under
the guidance of an uncle, completes a course of studies at William
and Mary, and finally practises law. His uncle now dying, he is left
pennyless; and his want of perseverance precludes any hope of
professional advancement. In this dilemma he falls in love. The
young lady is “a gentle, quiet, little creature,” has hazel eyes, auburn
hair, and “the loveliest face my eyes ever beheld.” Moreover, she is
“intellectual without being too much book-learned, kind without
seeming to intend it, and artless without affectation.” “Not a dog”
says Mr. French, “but read her countenance aright, and would follow
her until he obtained his dinner.” Besides all this, she has some little
property, a penchant for Mr. Richard Rolfe, and a very pretty
appellation, which is Gay Foreman. But that the course of true love
may not run altogether smooth, the young lady's father “knows a
thing or two,” and will have nothing to do with our hero. The damsel
too refuses to run away with him, and so he is forced to run away by
himself. In a word, he resolves “to leave the scene of his
unhappiness and seek a home in the western wilds.” “Oh poverty!
poverty!” says Mr. Richard Rolfe, in throwing his leg over the saddle,
“how often hast thou been sketched in some humble sphere, as
fascinating in the extreme—and indeed lovely art thou—in the
abstract!”—a very neat and very comfortable little piece of positive
fact, or as Ben D'Israeli would call it—of æsthetical psychology.

Our hero is next seen in Kentucky, where we find him, on the night
of the 10th of August 1809, in the woods, on the banks of the Ohio,
in company with one Mr. Earthquake, a hunter. A cry is suddenly
heard proceeding from the river. Stealthily approaching the banks,
Mr. R. and his friend look abroad and discover—nothing. Earthquake,
however, (whom our hero calls Earth for brevity) is of opinion that
the Indians have been murdering some emigrant family. While
deliberating, a light is discovered on the Illinois bank of the river, and
presently a band of Indian warriors become visible. They are
dancing a war-dance, with a parcel of bloody scalps in their hands,
and (credat Judæus!) with Mr. Rolfe's very identical little sweetheart
in their abominable clutches! “Is there a human bosom callous to the
appeals of pity?” here says Mr. Richard Rolfe, attorney at law, placing
his hand upon his heart. Mr. Earthquake, unfortunately, says nothing,
but there can be no doubt in any reasonable mind, that had he
opened his mouth at all, “Humph! here's a pretty kettle of fish!”
would have come out of it.

It appears that Mr. Rolfe having decamped from Petersburg, old Mr.
Foreman, as a necessary consequence, becomes unfortunate in
business, fails, and goes off to Pittsburg—or perhaps goes to
Pittsburg first and then fails—at all events it is incumbent upon him
to emigrate and go down the Ohio in a flat-boat with all his family,
and so down he goes. He arrives, of course, before any accident can
possibly happen to him, exactly opposite the spot where that ill-
treated young attorney, Mr. Rolfe, is sitting as aforesaid, with a very
long face, in the woods. But having got so far, it follows that he can
get no farther. The Indians now catch him—(what business had he
to reject Mr. Rolfe?) they give him a yell—(oh, the old villain!) they
kill him—(quite right!) scalp him, and throw him overboard, him and
all his family, with the exception of the young lady. Her they think it
better to carry across to the Illinois side of the river, and set her up
on the top of a rock just opposite our hero, with a view, no doubt, of
letting that interesting young gentleman behold her to the greatest
possible advantage.

But the glaring improbability of this rencontre (an incident upon


which the whole narrative depends) is perhaps the worst feature in
Mr. French's novel. Matters now proceed in a more rational manner.
The Indians, eight in number, having finished their war-dance, make
off with their prey. The two hunters (for Mr. R. has turned hunter)
swim the river and proceed to follow in pursuit, with the view of
seizing any favorable opportunity for rescuing the young lady. There
are now some points of interest. At one time, our friends, hiding in
the trunk of a tree, are near being discovered by the red men, when
these latter are turned from the path by the rattling of a snake. This
is a manœuvre on the part of Earthquake, who carries the rattles
about his person. Something of the same kind, however, is narrated
by Cooper. At another period, one of the eight becoming separated
from the party, is waylaid and dexterously slain. Mr. Rolfe too,
manages to obtain a glimpse of the face of the captive, and is
convinced of her being his inamorata. The pursuit, however, is
unsuccessful, and the maiden is carried to the camp of Tecumseh.

We have now a description of this warrior—of his brother


Elkswatawa, the Prophet—of Net-nok-wa, the female chief of the
Ottawas—and of Mis-kwa-bun-o-kwa her daughter. The two latter
are on a visit to Tecumseh, who refuses, for state reasons, the
proffered hand of Mis-kwa-bun-o-kwa. This princess, becoming
interested in the fate of our heroine, begs her of the Prophet as a
slave. The Prophet yields, and Miss Foreman is carried by Mis-kwa-
bun-o-kwa to visit some of the latter's friends on the Wabash, before
setting off for the more distant regions of her tribe. In the
meantime, our hunters, arriving at the camp, and having
reconnoitred it in vain for any traces of the captive, boldly enter the
camp itself, and demand the maiden at the hands of the Prophet.
His hostile intentions not being yet sufficiently ripe, Elkswatawa
receives them with kindness, and gives them fair words, but
disclaims any knowledge of Miss Foreman. Being desired, however,
to aid the search by means of his power as a Prophet, the Indian
finally points out the true route of Mis-kwa-bun-o-kwa's party, and
our hunters taking leave, determine, as nothing better can be done,
to return home for assistance. On their way they come across the
body of the Indian, who, it will be remembered, was separated from
his party and killed by our friends. Upon his person they find, among
other articles, a handkerchief marked with the letters R. Rolfe, in the
hand-writing of our hero. He remembers having exchanged
handkerchiefs with Miss F. on the day of his leaving Petersburg, and
his doubts are now, consequently, resolved into certainty. This
incident determines Rolfe to proceed immediately up the Wabash.
Here, too, he fails in the object of his search, and the hunters
commence their return. On the route an Indian woman is
discovered, bearing a torch, and looking for her son whom she
supposes to have been murdered by the whites. Touched with pity,
our friends aid her in the search, and the son is found, grievously
wounded, but not dead. In her lamentations, the mother drops some
few words about a white maiden who has taken shelter in her
wigwam, and the hopes of Rolfe are rekindled. They bear the
wounded man to the hut, and the white maiden, who is found dead,
proves not to be Gay Foreman. But the kindness of Rolfe and his
companion have excited a deep gratitude in the breasts of the
Indian mother and son—the latter is called Oloompa. They pledge
their aid in recovering the lady—and, Rolfe having entrusted
Oloompa with a letter for his mistress, the hunters resume their
journey. Reaching Indiana, they find that, owing to the unsettled
state of Indian affairs, no assistance can be rendered them in regard
to the rescue of Miss Foreman. They proceed to Kentucky.
Earthquake is made sheriff. Rolfe practises law, and having written
to Petersburg in relation to Miss F. receives an answer inducing him
to believe himself mistaken in regard to the identity of the captive.
In the meantime Netnokwa, Mis-kwa-bun-o-kwa and Miss Foreman
are living on the banks of the Red River. The lady is, in some
measure, reconciled to her fate by the kind attentions of her Indian
friends—who are only prevented from restoring her to the
settlements, through dread of the Prophet's resentment. Elkswatawa
and Tecumseh are busied in uniting the Indian tribes with the view
of a general attack upon the whites. An emissary is thus sent to the
wigwam of Netnokwa. Influenced by Miss Foreman the princesses
treat the messenger with contempt and laugh at the pretensions of
the Prophet. He returns home vowing vengeance, and Elkswatawa is
induced to send a party of six warriors for the purpose of bringing all
the inmates of Netnokwa's cabin to his camp.

The friendly Indian, Oloompa, determines, in the meantime, to


redeem his promise made to the two hunters, finds out the wigwam
of Netnokwa, delivers the letter of Rolfe, receives an answer from
Miss Foreman, proceeds with it to Kentucky, searches out our hero,
and returns with him as a guide to the dwelling of the Indian
princess. Earth accompanies them. The cabin is found deserted—the
inmates having been carried off the day before in the direction of
the Prophet's camp. But the ingenuity of Mis-kwa-bun-o-kwa has
contrived to leave, on a shelf of the cabin, a letter for the perusal of
Oloompa—whose return was, of course, expected. This letter
consists of a parcel of little clay figures, representing Netnokwa, Mis-
kwa-bun-o-kwa, and Miss Foreman, driven by six Indians in the
direction of the camp of the Prophet. Upon this hint our hero starts
with his two companions in pursuit. They fail, however, in overtaking
the Indians in time to accomplish a rescue. The captive with her
friends is carried to Tippecanoe, where the Prophet (Tecumseh
having gone to the South) is expecting an attack from the American
army under General Harrison. Entering the camp, Oloompa mingles
with the Indians and finally discovers the tent in which are the
princesses and Miss Foreman. Learning that the Prophet has granted
to Mis-kwa-bun-o-kwa the privilege of passing in and out of the tent
at pleasure, restricting her only to the limits of the camp, he obtains
an interview with her, and prevails upon her to disguise Miss
Foreman to represent herself, (the princess) and thus enable the
captive to pass out. The scheme succeeds, and our heroine is
restored to the arms of Mr. Rolfe, who is awaiting her beyond the
lines. In the meantime, the impatient Indians urge the Prophet to a
night attack upon Gen. Harrison. They are repulsed, and at the
conclusion of the battle, our friends make their way into the
American army. All difficulties now vanish. The lovers are married,
and the narrative is brought to a conclusion.

The dry compendium we have given will of course do little more


than afford some idea of the plan of the novel. Its chief interest
depends upon matters which we have avoided altogether, as being
independent of this plan, and as forming a portion of our Indian
history. Here Mr. French has been very successful. The characters of
Tecumseh and of Elkswatawa appear to us well drawn, and the
manœuvres skilfully detailed by means of which the vast power of
the Prophet was attained. It is possible however, that the bear, tiger,
Indian, and snake stories of our friend Earthquake, (with which the
volumes are plentifully interlarded,) will be considered as forming
the better portions of Elkswatawa. We have already adverted to the
gross improbability of the main incident upon which the narrative is
hinged. In the entire construction of the tale Mr. French has fallen
too obviously, we think, into some mannerisms of Sir Walter Scott.

In him (Sir Walter) these mannerisms, until the frequency of their


repetition entitled them to such appellation, being well managed and
not over-done, were commendable. They added great force and
precision to the development of his stories. They should now be
avoided—as a little too much of a good thing. And to a man of
genius the world of invention is never shut. There is always
something new under the sun—a fact susceptible of positive
demonstration, in spite of a thousand dogmas to the contrary. The
mannerisms we particularly allude to in Mr. French, are involved in
what he so frequently calls the “bringing up” of his narrative. Fixing
in his mind, every now and then, some particular epoch of his tale,
he deems it of essential importance (when it is by no means so) that
the action of his various characters should be “brought up,” with
entire regularity, to this epoch. The attention is no sooner engaged
in one train of adventure, than a chapter closes with some such
sentence as the following. “Leaving him to prosecute his journey,
and the hunters with a perfect knowledge of the route he had taken,
we return to the camp of the Prophet,” see chapter 21—or with
“Leaving the hunters to hover about the temporary camp of the
Indians, we must bring forward other parts of our story,” see chapter
3—or with “Thus amusing themselves, they continued their journey,
to perform which we must leave them, while we bring forward other
parts of our story,” see chapter 8—or “And now having brought up
the history of the Prophet to the period of which we are writing we
will proceed with our narrative,” see chapter 14—or “Leaving Rolfe to
attend to his profession, and Earthquake to discharge the duties of
the office which had just been conferred on him, let us proceed with
other parts of our story,” see chapter 15. Many of the chapters
commence in a similar strain, and even in the middle of some of
them the same interruptions occur. And this adjustment of the date
is so frequently repeated that Mr. French's readers are kept in a
constant state of chronological hornpipe.

There are some inadvertences to which the author's attention should


be called. When Rolfe, and his companion Earthquake, are in the
woods on the banks of the Ohio, at the time of the murder of Mr.
Foreman's family, they are represented (see page 32, vol. i,) as
hearing a sudden cry—upon which, proceeding to the river bank,
they look around and see—nothing. The boat containing the family
had sunk before their appearance and no traces remained. Yet on
page 113 of the same volume, we find the hunters giving to the
Prophet a detailed account of the massacre and burning—things of
which they could know nothing whatsoever.

When Mis-kwa-bun-o-kwa (that acute young lady) is about leaving


her wigwam on the Red River—forced away by the six Indians of the
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like