100% found this document useful (1 vote)
43 views53 pages

Clojure for the Brave and True Learn the Ultimate Language and Become a Better Programmer 1st Edition Daniel Higginbothampdf download

The document provides links to download various ebooks and textbooks, including 'Clojure for the Brave and True' by Daniel Higginbotham, which teaches the Clojure programming language. It emphasizes a practical approach to learning Clojure, starting with real programs and covering core functions, macros, and concurrency. Additional titles listed cover topics ranging from programming to diet and chess.

Uploaded by

nutuflook
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
43 views53 pages

Clojure for the Brave and True Learn the Ultimate Language and Become a Better Programmer 1st Edition Daniel Higginbothampdf download

The document provides links to download various ebooks and textbooks, including 'Clojure for the Brave and True' by Daniel Higginbotham, which teaches the Clojure programming language. It emphasizes a practical approach to learning Clojure, starting with real programs and covering core functions, macros, and concurrency. Additional titles listed cover topics ranging from programming to diet and chess.

Uploaded by

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

Download the full version and explore a variety of ebooks

or textbooks at https://ebookultra.com

Clojure for the Brave and True Learn the Ultimate


Language and Become a Better Programmer 1st
Edition Daniel Higginbotham

_____ Tap the link below to start your download _____

https://ebookultra.com/download/clojure-for-the-brave-and-
true-learn-the-ultimate-language-and-become-a-better-
programmer-1st-edition-daniel-higginbotham/

Find ebooks or textbooks at ebookultra.com today!


We have selected some products that you may be interested in
Click the link to download now or visit ebookultra.com
for more options!.

Becoming a Better Programmer A Handbook for People Who


Care About Code 1st Edition Pete Goodliffe

https://ebookultra.com/download/becoming-a-better-programmer-a-
handbook-for-people-who-care-about-code-1st-edition-pete-goodliffe/

Power Chess for Kids Learn How to Think Ahead and Become
One of the Best Players in Your School Charles Hertan

https://ebookultra.com/download/power-chess-for-kids-learn-how-to-
think-ahead-and-become-one-of-the-best-players-in-your-school-charles-
hertan/

The Social Origins of Language 1st Edition Daniel Dor

https://ebookultra.com/download/the-social-origins-of-language-1st-
edition-daniel-dor/

Trend Trading for a Living Learn the Skills and Gain the
Confidence to Trade for a Living 1st Edition Thomas K.
Carr
https://ebookultra.com/download/trend-trading-for-a-living-learn-the-
skills-and-gain-the-confidence-to-trade-for-a-living-1st-edition-
thomas-k-carr/
The new Atkins for a new you The ultimate diet for
shedding weight and feeling great forever 1st Edition Eric
C.Westman
https://ebookultra.com/download/the-new-atkins-for-a-new-you-the-
ultimate-diet-for-shedding-weight-and-feeling-great-forever-1st-
edition-eric-c-westman/

Sigurd and His Brave Companions A Tale of Medieval Norway


1st Edition Sigrid Undset

https://ebookultra.com/download/sigurd-and-his-brave-companions-a-
tale-of-medieval-norway-1st-edition-sigrid-undset/

Atomic Scala Learn Programming in the Language of the


Future 2nd Edition Dianne Marsh

https://ebookultra.com/download/atomic-scala-learn-programming-in-the-
language-of-the-future-2nd-edition-dianne-marsh/

Migration and Poverty Towards Better Opportunities for the


Poor 1st Edition Edmundo Murrugarra

https://ebookultra.com/download/migration-and-poverty-towards-better-
opportunities-for-the-poor-1st-edition-edmundo-murrugarra/

Flickr Mashups Programmer to Programmer 1st Edition David


A. Wilkinson

https://ebookultra.com/download/flickr-mashups-programmer-to-
programmer-1st-edition-david-a-wilkinson/
Clojure for the Brave and True Learn the Ultimate
Language and Become a Better Programmer 1st Edition
Daniel Higginbotham Digital Instant Download
Author(s): Daniel Higginbotham
ISBN(s): 9781593275914, 1593275919
Edition: 1
File Details: PDF, 5.59 MB
Year: 2015
Language: english
Clojure
S h elve i n : P r og r a mmi n g La ng uag e s/Clojure

Clojure Brave True


Join the Ranks of Noble Clojurists
For weeks, months —nay!—from the very moment you
were born, you’ve felt it calling to you. At long last you’ll

for The
be united with the programming language you’ve been
longing for: Clojure!

Brave
As a Lisp-style functional programming language, Clojure lets you write robust

The
for
and elegant code, and because it runs on the Java Virtual Machine, you can take
advantage of the vast Java ecosystem. Clojure for the Brave and True offers
a “dessert-first” approach: you’ll start play­ing with real programs immediately,
as you steadily acclimate to the abstract but powerful features of Lisp and
functional programming. Inside you’ll find an offbeat, practical guide to Clojure,

And
filled with quirky sample programs that catch cheese thieves and track glittery
vampires.

learn h o w to

True
And
• Wield Clojure’s core functions
• Use Emacs for Clojure development
• Write macros to modify Clojure itself
• Use Clojure’s tools to simplify concurrency and parallel programming

Clojure for the Brave and True assumes no prior experience with Clojure, the

learn the ultimate


Java Virtual Machine, or functional programming. Are you ready, brave reader,
to meet your true destiny? Grab your best pair of parentheses—you’re about to
embark on an epic journey into the world of Clojure!

language and

Daniel Higginbotham
About t he Au tho r
become a better
Daniel Higginbotham has been a professional programmer for 11 years, half of that at McKinsey &
Company, where he used Clojure to build mobile and web applications. He has also contributed to
the curriculum for ClojureBridge, an organization that offers free, beginner-friendly Clojure workshops

programmer
for women. Daniel blogs about life and programming at http://flyingmachinestudios.com/, and can be
found on Twitter, @nonrecursive. He lives in Durham, North Carolina, with his wife and four cats.

C o v e r s C l o j u r e 1.7
r e q u i r e s J ava 1.6 or l ate r

$34.95 ($40.95 CDN)

w w w.nostarch.com
THE FINEST IN
G E E K E N T E R TA I N M E N T ™
Daniel Higginbotham
Clojure for the Brave and True
Clojure for the Brave and True. Copyright © 2015 by Daniel Higginbotham.

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.

Printed in USA

First printing

19 18 17 16 15   1 2 3 4 5 6 7 8 9

ISBN-10: 1-59327-591-9
ISBN-13: 978-1-59327-591-4

Publisher: William Pollock


Production Editor: Riley Hoffman
Cover Design: Beth Middleworth and Daniel and Jessica Higginbotham
Cover and Interior Illustrations: Jessica Higginbotham
Interior Design: Octopod Studios
Developmental Editors: Hayley Baker and Seph Kramer
Technical Reviewer: Alan Dipert
Copyeditor: Anne Marie Walker
Compositors: Riley Hoffman and Susan Glinert Stevens
Proofreader: Emelie Burnette

For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly:

No Starch Press, Inc.


245 8th Street, San Francisco, CA 94103
phone: 415.863.9900; [email protected]
www.nostarch.com

Library of Congress Cataloging-in-Publication Data

Higginbotham, Daniel.
Clojure for the brave and true : learn the ultimate language and become a better programmer / by
Daniel Higginbotham.
pages cm
Includes index.
Summary: "Guide to the functional programming language Clojure. Teaches tools and techniques for
writing programs in Clojure. Covers how to wield and compose Clojure's core functions; use Emacs
for Clojure development; write macros to modify the Clojure programming language; and use Clojure's
tools to simplify concurrency and parallel programming"-- Provided by publisher.
ISBN 978-1-59327-591-4 -- ISBN 1-59327-591-9
1. Clojure (Computer program language) I. Title.
QA76.73.C565H54 2015
005.13'3--dc23
2015014205

No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other
product and company names mentioned herein may be the trademarks of their respective owners. Rather
than use a trademark symbol with every occurrence of a trademarked name, we are using the names only
in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.

The information in this book is distributed on an “As Is” basis, without warranty. While every precaution
has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any
liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or
indirectly by the information contained in it.
About the Author
Daniel Higginbotham has been a professional programmer for 11 years,
half of that at McKinsey & Company, where he used Clojure to build
mobile and web applications. He has also contributed to the curriculum
for ClojureBridge, an organization that offers free, beginner-friendly
Clojure workshops for women. Daniel blogs about life and program-
ming at http://flyingmachinestudios.com/, and can be found on Twitter,
@nonrecursive. He lives in Durham, North Carolina, with his wife and
four cats.

About the Technical Reviewer


Alan Dipert first heard about Lisp when he was 10 years old. After it
was described to him, he said “That sounds dumb.” In 2009, he learned
Clojure and revised his opinion. Alan has designed and built Clojure
systems, conducted Clojure trainings, and spoken at Clojure conferences.
You can keep track of Alan’s work and recent opinions by visiting http://
tailrecursion.com/~alan or by following him on Twitter, @alandipert.
For Jess
Brief Contents

Foreword by Alan Dipert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi

Part I: Environment Setup

Chapter 1: Building, Running, and the REPL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Chapter 2: How to Use Emacs, an Excellent Clojure Editor . . . . . . . . . . . . . . . . . . . . . . . . . 11

Part II: Language Fundamentals

Chapter 3: Do Things: A Clojure Crash Course . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Chapter 4: Core Functions in Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Chapter 5: Functional Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Chapter 6: Organizing Your Project: A Librarian’s Tale . . . . . . . . . . . . . . . . . . . . . . . . . . 125

Chapter 7: Clojure Alchemy: Reading, Evaluation, and Macros . . . . . . . . . . . . . . . . . . . . 147

Chapter 8: Writing Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

Part III: Advanced Topics

Chapter 9: The Sacred Art of Concurrent and Parallel Programming . . . . . . . . . . . . . . . . . 189

Chapter 10: Clojure Metaphysics: Atoms, Refs, Vars, and Cuddle Zombies . . . . . . . . . . . . 207

Chapter 11: Mastering Concurrent Processes with core.async . . . . . . . . . . . . . . . . . . . . . 233

Chapter 12: Working with the JVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

Chapter 13: Creating and Extending Abstractions with Multimethods,


Protocols, and Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Appendix A: Building and Developing with Leiningen . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

Appendix B: Boot, the Fancy Clojure Build Framework . . . . . . . . . . . . . . . . . . . . . . . . . . 281

Farewell! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

x   Brief Contents
Conte nt s in De ta il

Foreword by Alan Dipert xvii

Acknowledgments xix

Introduction xxi
Learning a New Programming Language: A Journey Through the Four Labyrinths . . . . . xxii
How This Book Is Organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Part I: Environment Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Part II: Language Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Part III: Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv
The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
The Journey Begins! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv

Part I: Environment Setup


1
Building, Running, and the REPL 3
First Things First: What Is Clojure? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Leiningen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Creating a New Clojure Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Running the Clojure Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Building the Clojure Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Using the REPL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Clojure Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2
How to Use Emacs, an Excellent Clojure Editor 11
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Emacs Escape Hatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Emacs Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Key Bindings and Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Emacs Is a Lisp Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Installing Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Core Editing Terminology and Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Selection with Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Killing and the Kill Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Editing and Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Using Emacs with Clojure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Fire Up Your REPL! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Interlude: Emacs Windows and Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
A Cornucopia of Useful Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
How to Handle Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Paredit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Continue Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Part II: Language Fundamentals

3
Do Things: A Clojure Crash Course 35
Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Control Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Naming Values with def . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Simplicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Calling Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Function Calls, Macro Calls, and Special Forms . . . . . . . . . . . . . . . . . . . . . . . 50
Defining Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Returning Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Pulling It All Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
The Shire’s Next Top Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
let . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Symmetrizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Better Symmetrizer with reduce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Hobbit Violence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

4
Core Functions in Depth 71
Programming to Abstractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Treating Lists, Vectors, Sets, and Maps as Sequences . . . . . . . . . . . . . . . . . . . 73
first, rest, and cons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Abstraction Through Indirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Seq Function Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
reduce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
take, drop, take-while, and drop-while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

xii   Contents in Detail
filter and some . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
sort and sort-by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
concat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Lazy Seqs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Demonstrating Lazy Seq Efficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Infinite Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
The Collection Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
into . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
conj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Function Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
apply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
partial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
complement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
A Vampire Data Analysis Program for the FWPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

5
Functional Programming 97
Pure Functions: What and Why . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Pure Functions Are Referentially Transparent . . . . . . . . . . . . . . . . . . . . . . . . . 98
Pure Functions Have No Side Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Living with Immutable Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Recursion Instead of for/while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Function Composition Instead of Attribute Mutation . . . . . . . . . . . . . . . . . . . 103
Cool Things to Do with Pure Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
comp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
memoize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Peg Thing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Playing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Code Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Creating the Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Moving Pegs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Rendering and Printing the Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Player Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

6
Organizing Your Project: A Librarian’s Tale 125
Your Project as a Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Storing Objects with def . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Creating and Switching to Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
refer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
alias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Real Project Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
The Relationship Between File Paths and Namespace Names . . . . . . . . . . . . 133
Requiring and Using Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
The ns Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
To Catch a Burglar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

Contents in Detail   xiii
7
Clojure Alchemy: Reading, Evaluation, and Macros 147
An Overview of Clojure’s Evaluation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
The Reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Reader Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
The Evaluator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
These Things Evaluate to Themselves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Syntactic Abstraction and the -> Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

8
Writing Macros 165
Macros Are Essential . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Anatomy of a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Building Lists for Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Distinguishing Symbols and Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Simple Quoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Syntax Quoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Using Syntax Quoting in a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Refactoring a Macro and Unquote Splicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Things to Watch Out For . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Variable Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Double Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Macros All the Way Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Brews for the Brave and True . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Validation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
if-valid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

Part III: Advanced Topics

9
The Sacred Art of Concurrent and
Parallel Programming 189
Concurrency and Parallelism Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Managing Multiple Tasks vs. Executing Tasks Simultaneously . . . . . . . . . . . . . 190
Blocking and Asynchronous Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Concurrent Programming and Parallel Programming . . . . . . . . . . . . . . . . . . . 191
Clojure Implementation: JVM Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
What’s a Thread? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
The Three Goblins: Reference Cells, Mutual Exclusion, and
Dwarven Berserkers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

xiv   Contents in Detail
Exploring the Variety of Random
Documents with Different Content
CHAPTER V.
Patrick found that his family had indeed made a happy change.
There was no gainsaying that. And he himself experienced no
difficulty in procuring employment; but he was far from being so well
content as the others. He wrote to Norah upon his arrival at New
York, and again when he had found his father and mother; and he
wanted sadly to invite her to join him in America. But for the same
reason that he did not return to Ireland, he dared not ask her to
come over; for if he could not leave his friends how could she hers?
He would have gone “home,” as he persisted in calling it, but,
strange to say, Ellen was not in the least humbled in her exactions
by the fact of her own marriage. She loved Pat better than any body
in this world, her own husband and her own child not excepted, and
it was with a feeling of wrong that she heard or thought of his loving
any one else, or being beloved by any.
Sad news began now to come from the old country. The O’Brien’s
had no letters; but others had, and the newspapers were full of the
dreadful destitution and the deaths from starvation in Ireland. Now
poor Patrick was worse afflicted than he had been by separation
from his parents. Tidings came of starvation and death in houses the
inhabitants of which he knew were wealthier far than Norah’s father;
and he feared and dreaded that she might even want for a bit of
bread, while he rolled in plenty. Had he pursued his own inclination
he would have posted back—but Ellen said—“Don’t think of such a
thing! Is it mad you are? When there’s people dying there of the
hunger will you go snatch the bread from their mouths? Or will you
go ‘home,’ as you call it, and feed the three kingdoms from your own
pocket?” Patrick was hurt—and he thought of the two Norah was far
the better comforter.

Deep indeed was the distress that rested upon unhappy Ireland.
And Patrick’s fears for his friends at home were but too well
founded. Sickness and famine invaded the district in which Patrick
was born; and though his old master at first was bountiful to those
around him, stern necessity at last brought its admonition that he
must hold his hand. There is distress that opens the heart; but when
it comes to dividing your living with your neighbor, to become at last
fellow in his need, the instinct of self-preservation chills charity.
Nevertheless, the good farmer gave—and gave a day too long; for
the time came when he could count his own scanty provision in food
and in purse. Impoverished, he learned at last to suffer and to
sicken. He buried his wife out of his sight, and his children sunk one
after another into the grave. He denied himself bread to feed his
famishing family—almost rejoicing, while the dead lay unburied in his
house, that with the release of child after child, the need of food and
the wail of hunger diminished. And now at last Norah and himself
only remained of all that happy household; and they had but to
prepare their last food and die. The immense demand which had
been made upon the charitable had proved too great for the supply;
and men had ceased at last to think it a strange thing that people
died of hunger.
Often did Norah think in her distress of him who was now far
away. And heartily she rejoiced for his sake, that he had not
remained to add another claimant on the public charity, to the
thousands who pleaded unavailingly for it. But it was sad to think
that he must one day hear that her he loved had sunk into the
grave, the last of her house, for to death she firmly looked as the
only hope of release from suffering.
A footstep broke the silence; but it hardly disturbed her revery. It
was the kind ecclesiastic who had been present at the death of her
mother and her brothers—who had seen her sister’s eyes closed,
and to whom she herself looked, at no distant day for the last offices
of the church. His frequent visits had become part of her daily
experience, but she saw now that his face wore something more
than the usual calm expression. She looked up inquiringly, and he
placed in her hands a letter, addressed to his care for her.
She knew the handwriting, and could scarce command firmness
to break the many seals and wafers with which over caution had
secured the letter. It was from Patrick, and enclosed more money
than she had before seen for many weeks. “Now, God be praised,”
she cried, “my father shall find comfort again!”
“He has found it, daughter!” said the priest in a solemn voice
from the bedside. Norah hurried there, to receive, in the last faint
smile, a father’s inaudible blessing.

Need we say that the good priest gave Norah sound advice: to
wit, that the money which she had received were better expended in
finding her way to Patrick, than in protracting a weary existence in
the place now so sad to her. Ellen’s welcome was not the least
hearty which Norah received; and all agree that there was a
Providence in the events which guided Patrick before her to America.
Norah is cherished as one of the “childher,” and Mrs. O’Brien insists
that her mistake at the bedside years before, was only a bit of
prophecy, for her heart always yearned to Norah as one of her own.
All are well pleased; and though a shade of sorrow for her kindred is
habitual to the countenance of Mrs. Norah O’Brien, it adds to the
sweetness of its expression, and is a better look, in its resignation,
than one of discontent or of vacuity.
As to the young cousins in the neighborhood, we leave their
statistics to the next census. They have proved jewels of comfort to
Grandfather Patrick, who, though quite infirm, is still useful to “mind
the childer;” while Mrs. O’Brien, the grandmother, labors like
Sisyphus to keep little feet in hose, with no hope that her work will
ever cease while her breath lasts, or her fingers can ply a needle.
A HOUSEHOLD DIRGE.
———
BY R. H. STODDARD.
———

I’ve lost my little May at last;


She perished in the Spring,
When earliest flowers began to bud,
And earliest birds to sing;
I laid her in a country grave,
A rural, soft retreat,
A marble tablet o’er her head
And violets at her feet!

I would that she were back again,


In all her childish bloom;
My joy and hope have followed her,
My heart is in her tomb;
I know that she is gone away,
I know that she is fled,
I miss her everywhere, and yet
I cannot make her dead!

I wake the children up at dawn,


And say a simple prayer,
And draw them round the morning meal,
But one is wanting there;
I see a little chair apart,
A little pin-a-fore,
And Memory fills the vacancy,
As Time will—nevermore!
I sit within my room, and write
The lone and weary hours,
And miss the little maid again
Among the window flowers;
And miss her with her toys beside
My desk in silent play,
And then I turn and look for her,
But she has flown away!

I drop my idle pen and hark,


And catch the faintest sound;
She must be playing hide-and-seek
In shady nooks around;
She’ll come and climb my chair again.
And peep my shoulder o’er,
I hear a stifled laugh—but no,
She cometh nevermore!

I waited only yester night,


The evening service read,
And lingered for my idol’s kiss,
Before she went to bed,
Forgetting she had gone before,
In slumbers soft and sweet,
A monument above her head,
And violets at her feet!
THE YOUNG ARTIST:
OR THE STRUGGLE FOR INDEPENDENCE.

———
BY T. S. ARTHUR
———

(Continued from page 8.)


CHAPTER IV.
Clara, as has been seen, fell into a thoughtful, sober state of
mind, after the interview with her husband, in which she mentioned
the fact of having five thousand dollars in stocks. Something in the
manner of Alfred troubled her slightly. When he came home in the
evening she experienced, in meeting him, the smallest degree of
embarrassment; yet sufficient for him to perceive. Like an inflamed
eye to which even the light is painful, his morbid feelings were
susceptible of the most delicate impressions. A mutual reserve,
unpleasant to both, was the consequence. Ellison imagined that his
wife had, on reflection, become satisfied of his baseness in seeking
to obtain her hand in marriage because of her possession of
property, and the change in his manner which this feeling produced,
naturally effected a change in her. From that time their intercourse
became embarrassed, and both were unhappy.
A few days after Clara had informed her husband of the fact that
she possessed five thousand dollars in stocks, she brought him the
certificates which she held, and placing them in his hands, said,
“You must take care of these now.”
“What are they?” he asked, affecting an ignorance that did not
exist, for the instant his eyes rested on the papers he understood
what they were.
“Certificates of the stock about which I told you.”
Ellison handed them back quickly, and with a manner that could
not but wound the feelings of his wife, saying at the same time,
“Oh, no, no! I don’t want them. Draw the interest yourself as you
have been doing.”
“I have no further need of the money,” replied Clara, in a voice
that had acquired a sudden huskiness. “Our interests are one you
know, Alfred, and you take care of these matters now.”
But, the young man, acting under a perverse and blind impulse,
positively refused to keep the certificates.
“I’d rather you would draw the money as you have been doing,”
said he, his voice much softened and his manner changed. “It may
be weakness in me, but I feel sensitive on this subject.”
Ellison’s evil genius seemed to have him in possession.
“On what subject?” inquired Clara, in a tone of surprise.
“On the subject of your property,” replied Ellison, with a want of
delicacy the very opposite of his real character.
If a cold hand had been laid upon the bosom of Clara, she could
not have experienced a more sudden chill. She made no reply.
Ellison perceived, in an instant, the extent of his error. Like a man
struggling in the mire, every moment seemed but to plunge him
deeper. A more painful reserve followed this brief but unhappy
interview. Deeply did the young man regret not having taken the
certificates when they were handed to him. That was his only right
course. But they were presented unexpectedly, and the first
suggestion which came was that the act was more compulsory than
voluntary on the part of his wife.
The subject was not alluded to again, but it was scarcely for a
moment out of the thoughts of either Clara or her husband. When
the half-yearly interest became due, which was in the course of a
week, Clara drew the money. It amounted to the sum of one
hundred and fifty dollars.
“You will not refuse this, I hope?” said she smiling, as she
handed him what she had received. “It is the half-yearly interest on
our stock.”
Alfred was a little wiser by experience.
“I have no particular use for it just now,” was his reply. “Suppose
you keep it and pay our board every week as long as it lasts.
Twenty-four dollars will be due to-morrow.”
“Very well, just as you like, Alfred. If you should want any of it,
you must help yourself. You will find it in my drawer.”
“I’ll call on you if I should get out of pocket,” was replied to this
in a playful tone of voice.
Both felt relieved. But it grew out of the fact that Ellison had
been able to disguise his real feelings, and this was but a false
security. There was a certainty, however, about the means of paying
the weekly charge for boarding, that was a great relief to the mind
of Ellison, and which enabled him the better to hide his real feelings
from his wife. Happily for him, the four pictures which had been
talked about were ordered. He completed them in about five weeks,
and received two hundred dollars, the price agreed upon. One
hundred of this sum he paid to the friend who had loaned him the
money to lift the obligation that was felt to be so oppressive. Fifty of
what remained he placed in the hands of Clara, playfully saying to
her as he did so, that she must be his banker. The remark was
timely and well expressed, and it had its effect both upon his own
mind and that of his wife. But the source of trouble lay too deep to
be easily removed.
Seek to disguise it as he would, Ellison could not hide from
himself the fact, that he had suffered a great disappointment. Often
and often, would come back upon him his old dream of the sunny
clime of art and music, and he would feel the old, irrepressible
longing to visit the shores of Italy. At last, it was some months after
his marriage, he said to Clara, something favoring the remark —
“I don’t think I shall ever be happy until I have seen the galleries
of Rome and Florence.”
Clara looked surprised at this remark, it was so unexpected, for
no intimation of such a feeling had ever been breathed ere this by
her husband.
“Why do you wish to go there?” she naturally inquired.
“To took upon the glorious old masters,” replied Ellison. “I will
never be any thing in my art until I have studied them.”
“You think too meanly of your present attainments,” said Clara.
“N—— has been to Italy, but with all his study of the old masters he
has not half the ability as an artist that you possess.”
“It isn’t in him, Clara,” replied Ellison with some warmth. “He
might study in the galleries of Florence forever, and not make a
painter.”
“There are many specimens and copies of the old masters in our
city,” remarked Clara, “could you not find aid from studying them?”
“No, no—or at least but little,” said Ellison coldly. He had hoped
that his wife would feel favorable, at least, to a visit to Italy, even
though it might not at the time be practicable. But her evident
opposition to the thing chilled his over-sensitive feelings.
“Ah me!” sighed the young artist to himself, when alone, “I am
free in nothing!”
Other thoughts were coming into utterance, but he checked and
drove them back. As for Clara, she was utterly unconscious of what
was in the mind of her husband. Could she have understood his real
feelings, she would have sacrificed even her natural prudence and
forethought, and cheerfully proposed to sell the stock they
possessed in order that they might visit Italy and spend a year or
two in that classic region. But a reserve had already been created,
and Ellison, in particular, kept secret more than half of what was
passing in his mind, while he imagined his wife to have thoughts and
feelings to which she was a total stranger. He said no more about
Italy, for it was plain to him that she would oppose the measure if
suggested; and, as she had brought him a few thousands, she of
course had a right to object.
Fortunately for the young artist, the four pictures which he had
painted gave excellent satisfaction. In fact, they were his best works.
The mind, when smarting under pain, often acts with a higher vigor,
while the perceptions acquire a new intensity; and this was the real
secret of his better success. The pictures pleased so well that they
brought him other sitters, and he was able, some time before Clara’s
instalment of interest was exhausted, to place more money in her
hands. The fact of doing this was always a relief to his mind. It was
a kind of tacit declaration of independence. From that time both his
work and his ability increased, and he was able to make enough to
meet, with the aid of his wife’s income, the various expenses to
which he was subjected, and to pay off the few obligations that were
held against him. But he was not happy. No man can be who
forfeits, by any act that affects the whole of his after life, his self-
respect; and this Ellison had done. In spite of his better judgment,
he would permit himself to see in Clara’s words, looks and conduct,
a rebuke of the mercenary spirit that first led him to seek her favor.
Nothing of this was in her heart. But guilt makes the mind
suspicious.
——
CHAPTER V.
The young artist worked on with untiring assiduity—he was
toiling for independence. Never, since his marriage, had he breathed
the air with the freedom of former times. The reaction of his often
strange manner—his days of reserve—had been felt by his wife, and
the effect upon her was plainly to be seen. With a perverseness of
judgment, hardly surprising under the circumstances, he attributed
the change in Clara to her suspicions as to the purity of his motives
in seeking an alliance. In the meantime, he had become more
intimately acquainted with her relatives, none of whom he liked very
well. Her oldest brother interfered a good deal in the suit which he
was engaged in defending on behalf of his wife; and by much that
he said, left the impression that he did not think Ellison’s judgment
sound enough in business matters to advise a proper course of
action.
This fretted the sensitive and rather irritable young man, and, in
a moment when less guarded than usual, he told him that he felt
himself fully competent to manage his own affairs, and hoped that
he would not, in future, have quite so much to say about things that
did not concern him. The brother was passionate, and stung Ellison
to the quick by a retort in which he plainly enough gave it as his
opinion that before five years had gone by, his sister’s property
would all be blown to the winds through his mismanagement. This
was little less than breaking Ellison on the wheel. He turned quickly
from his cool, sneering opponent, and never spoke to him afterward.
Piqued, however, by the taunt, he proposed to Clara that they should
visit the West, and remain there for as long a time as it was
necessary to personally look after their interests. He could paint
there as well as at the East; and might possibly do better for a time.
To this Clara’s only objection was the necessity that it would involve
for disposing of some of their stock, in order to meet the expense of
removal, and the sustaining of themselves, if Alfred should not
readily obtain employment as an artist, thus lessening the amount of
their certain income.
“But see how much is at stake,” replied Alfred. “All may be lost
for lack of a small sacrifice.”
“True,” said Clara, in instant acquiescence. “You are right.”
But when the proposed movement of Ellison and his wife became
known, her relatives had a good deal to say about it. George Deville,
the oldest brother, whose feelings now led him to oppose any thing
that he thought originated with Alfred, pronounced it as
preposterous.
“Why don’t Ellison go himself?” said he. “What does he expect to
gain by dragging Clara out there?”
“You surely are not going off to Ohio on such an expedition,” was
his language to his sister.
“Yes,” she replied to him, mildly, “I am going.”
“What folly!” he exclaimed.
“George,” said Clara, in a firm, dignified manner, “I must beg of
you not to interfere in any way between my husband and myself. In
his judgment I am now to confide, and I do it fully. We think it best
to go and see personally after our own interests.”
“But Clara—”
“Pardon me, George,” interrupted the sister, “but I must insist on
your changing the subject.”
Deville became angry at this, and as he turned to go away, said
something about her being beggared by her “husband’s fooleries,” in
less than five years.
It so happened that Ellison entered at this moment, and heard
the insulting remark. It was with an effort that he kept himself from
flinging the brother, in a burst of unrestrained passion, from the
room. But he controlled himself, and recognised him only by an
angry and defiant scowl. As Deville left the room, Clara burst into
tears, and placing her hands over her face, stood weeping and
sobbing violently. Alfred’s mind was almost mad with excitement. He
did not speak to his wife at first, but commenced walking hurriedly
about the room, sometimes throwing his arms over his head, and
sometimes clasping his hands tightly across his forehead. But, in a
little while, his thoughts went out of himself toward Clara, and he
felt how deeply pained she must be by what had just occurred. This
softened him. Approaching where she still stood weeping, he took
her hand and said,
“We would have been happier, had you been penniless like
myself.”
The tears of Clara ceased flowing almost instantly. In a few
moments she raised her head, and looking seriously at her husband,
asked,
“Why do you say that, Alfred?”
“No such outrage as the present could, in that case, ever have
occurred.”
“If George thinks proper to interfere in a matter that does not in
the least concern him, we need be none the less happy in
consequence. I feel his words as an insult.”
“And so they are. But they do not smart on my feelings the less
severely. Lose your property! He shall know better than that, ere five
years have passed.”
“Don’t let it excite you so much, Alfred. His opinion need not
disturb us.”
“It has disturbed you, even to tears.”
“It would not have done so, had not you happened to hear what
he said. This was what hurt me. But as we have provoked no such
interference as that which my brother has been pleased to make;
and, as we are free to do what we think right, and competent to
manage our own affairs, I do not see that we need feel very
unhappy at what has occurred.”
“If you have any doubts touching the propriety of doing what I
suggested, let us remain where we are,” said Ellison.
“I have no doubts on the subject,” was Clara’s quick reply. “I
think that where so much property is in danger, that we ought to
take all proper steps to protect our interests; and it is impossible for
us to do this so well at a distance as we could if on the spot where
the contest is going on. When you first proposed it, I did not see the
matter so clearly as I do now.”
Preparations for a temporary removal to the West were
immediately commenced; and in the course of a few weeks they
were ready for their departure. There was not a single one of Clara’s
relatives who did not disapprove the act, nor who did not exhibit his
or her disapproval in the plainest manner. This, to Alfred, was
exceedingly annoying, in fact, coming as it did on his already morbid
and sensitive feelings, actually painful.
“They shall see,” he said to himself, bitterly, “whether I squander
her property! If I don’t double it in five years, I’m sadly mistaken.”
This was uttered without there being any clearly defined purpose
in the young man’s mind; but it was in itself almost the creation of a
purpose. From that moment he became possessed with the idea of
so using his wife’s property as to make it largely reproductive. He
studied over it every day, and remained awake, with no other
thought in his mind, long after he had laid his head upon his pillow
at night.
With five hundred dollars in cash, obtained through the sale of
five shares of stock, Ellison and his wife started for the West on the
errand that we have mentioned. Clara looked for an early return, but
Alfred left his native city with the belief that he would never go back
there to reside; or if so, not for many years. Plans and purposes
were dimly shadowing themselves forth in his mind, as yet too
indistinct to assume definite forms, yet absorbing most of his
thoughts. For the time all dreams of Italy faded, and in vague
schemes of money-making, he forgot the glories of his art.
The place of their destination was a growing town, numbering
about six thousand inhabitants. Near this lay the five hundred acres
of land in dispute. On arriving, they took lodgings at a hotel, and, in
due time, sent for the agent who had charge of the property. He
informed them as to the state of affairs, and assured them that all
was going on as safely as possible. The case had been called at the
last term of court, but was put off for some reason, and would not
be tried for three months to come, when they hoped to get a
decision. If favorable or adverse, an appeal would be made, and a
year might probably elapse before a final settlement of the
questioned rights could be obtained.
Ellison hinted at their purpose in visiting the West. The agent
said, in reply, that their presence would not in the least affect the
case. It would be as safely managed if they were in Europe.
“That is all easily enough said,” remarked Alfred, after he was
alone with his wife; “but I am disposed to think differently. Every
man ought to understand his own business, and watch its progress.”
In this view Clara fully acquiesced; and they made their
arrangements to reside in the West for at least some months to
come. In the course of a week or two Ellison announced himself as
an artist from the East, whose intention it was to pass a short time
in D——. He arranged a studio, and made all needful preparation for
sitters; but, during the first two months of his residence there, not
an individual came forward to be painted. Expenses were going on
at the rate of about fifteen dollars a week, with a good prospect of
their being increased ere long. This was rather discouraging, and it
may be supposed that the young artist was in no way comfortable
under the circumstances. By this time he had become so well
acquainted with the state of the case pending, as to be pretty well
satisfied that his presence would be of no great utility in securing a
favorable termination of the affair. If he had come to the West alone,
a week’s personal examination of the position of things would have
enabled him to see their entire bearing, and to understand that his
presence was in no way necessary.
This conviction, to which the mind of Ellison came reluctantly, did
not by any means help him to a better state of feeling. He had
closed his studio at the East, just as he was beginning to get sitters
enough to secure a pretty fair income, and was in a strange place,
where people were yet too busy in subduing nature’s ruder features
to think much of the arts. He was the only painter in town; yet he
did not receive an order. Occasionally one and another called at his
rooms, looked at his pictures, asked his prices, and talked about
having some portraits taken. But it never went beyond this.
Steadily the sum of money they had brought with them
diminished, and nothing came in to supply the waste. To go back
again was, to one of Ellison’s temperament, next to impossible; and
even if he returned, he felt now no certainty of being able to do so
well as when he left. His unhappiness, which he could not conceal,
troubled Clara, who understood its ground. He was talking, one day,
in a desponding mood, of his doubtful prospects, when Clara said to
him,
“There is no need, Alfred, of your feeling so troubled. We have
enough to live on, certain, for the next four or five years, even if you
do not paint a portrait; to say nothing of the property in dispute,
which will, without doubt, come, with a clear title, into our
possession before a very long time.”
“All very true,” replied Alfred. “But that consideration doesn’t help
me any. I cannot see your property wasting away without feeling
unhappy. It is for me to increase it; whereas, now, I am the cause of
its diminution.”
“Alfred, why will you talk thus?” said Clara, in a distressed tone of
voice. “Why will you always talk of my property? When I gave you
myself, did not all I possessed become as much yours as mine?”
Alfred sat silent.
“We need not remain here,” resumed Clara, “any longer than it
will be useful.”
“I cannot go back to Philadelphia,” said Alfred, quickly. “At least
not until the business upon which we came has reached a favorable
termination.”
Clara did not ask why he said this; for she comprehended clearly
his feelings.
“We needn’t return there,” she replied. She said this,
notwithstanding her own desire to go back was very strong. “In
Cincinnati, artists are encouraged. We can go there.”
“Yes, or to one of the cities lower down the river. Any thing
rather than return to the East with your property lessened a single
dollar.”
“It is wrong for you to feel so, Alfred—very wrong,” said Clara.
“We ought always to let a conviction of having acted from right
motives sustain us in every position in life. Here, and only here, is
the true mental balance.”
Alas for Ellison! the lack of this very conviction was at the
groundwork of his inquietude. The property that now caused him so
much trouble was the first thing that drew him toward his wife; and
all the alloy that had mixed itself with his happiness came from this
source. Had she not been the possessor of a dollar, and had he been
drawn toward her for her virtues alone, their minds would have
flowed together as one, and, in the most perfect union, they would
have met and overcome whatever difficulties presented themselves.
But all was embarrassment now, rendered more oppressive through
the morbid pride of the young man, who felt every moment as if a
window were about to open in his breast, so that his wife could see
the baseness of which he had been guilty. This very effort at
concealment but awakened a suspicion of what was there.
The conversation continued, Alfred getting in no better state of
mind, until Clara became so hurt, or rather distressed, by many
things said by her husband, that she could not control her feelings
and gave vent to them in tears. Thus, as week after week went by,
the causes of unhappiness rather increased than diminished.

——
CHAPTER VI.
Ellison had been in D—— three months, and was about leaving
for Cincinnati, when his lawyer called on him, and stated that he was
authorized by the opposing counsel to say, that the plaintiffs in the
case were willing to withdraw their suit if one hundred acres of the
land in question were relinquished.
“At the same time,” remarked the lawyer, in giving this
information, “it is but right for me to state my belief that the offer
comes as the result of a conviction that the claim urged for the
ownership of the property has no chance of a favorable termination.”
“Yet the suit may be continued for two or three years,” said
Ellison.
“Yes, and they can put you to a great deal of trouble and
expense.”
“And there is at least a doubt resting on the issue.”
“There is upon all legal issues.”
“Then I think we had better accept the compromise.”
“You must decide that for yourself,” said the lawyer.
“How long will the question be open?”
“For some days, I presume.”
“Very well. I will see you about it to-morrow, or at latest on the
day after.”
Clara, on being informed of the new aspect the case had
assumed, fully agreed with her husband that the offer of a
settlement had better be met affirmatively; and this being done, the
suit was withdrawn, and they were left in the peaceable possession
of some four hundred acres of excellent land. The costs were nearly
two hundred dollars. This made it necessary to part with more of
their stock, which was effected through their agent at the East. Five
more shares were sold.
The termination of this suit wrought an entire change in the
views and purposes of Ellison. A residence in the West of three
months had brought him in contact with people of various characters
and pursuits, all eagerly bent on money-making. Towns were
springing up as if by magic, and men not worth a dollar to-day were
counting their thousands to-morrow. The spirit of enterprise was all
around him; and it was hardly possible for him to remain unaffected
by what was in the very atmosphere that he was breathing.
“Let me congratulate you on the happy termination of your suit,”
said an individual with whom Ellison had some acquaintance, a day
or two after all was settled. “You have now as handsome a tract of
land as there is in the state; and if you manage it aright, will make
out of it an independent fortune.”
This language sounded very pleasant in the ears of Ellison.
“You know the tract?” said he.
“Oh yes! Like a book. I’ve traveled over every foot of it. There is
a hundred thousand dollars worth of timber on it.”
“Not so much as that.”
“There is, every dollar of it. Not as fire-wood, of course.”
“In lumber, you mean.”
“Exactly.”
The man’s name was Claxton. He had come to D——, about a
year previously, with some six thousand dollars in cash, and as full of
enterprize and money-loving ambition as a man could well be. The
town was growing fast, and the supply of lumber, which a saw-mill
of very limited capacity was turning out, so poorly met the demand,
that prices ranged exceedingly high. A large landholder, whose
interests were seriously affected by this high rate of lumber, made
Claxton believe that he had only to erect a steam saw-mill, capable
of turning out, per day, a certain number of feet of boards and
scantling, and his fortune was made. Without stopping to investigate
the matter beyond a certain point, and taking nearly all the
statements made by the individual we have named for granted,
Claxton ordered a steam-engine from Pittsburg, rented a lot of
ground on the bank of the river, and forthwith commenced the
erection of his mill. As soon as the citizens of D—— understood what
he was about, there were enough of them to pronounce his scheme
a foolish one, in which he would inevitably lose his money. But he
had made all the calculations—had anticipated, like a wise man, all
the difficulties; and knew, or thought he knew, exactly what he was
about. It was nearly a year before he had his mill ready. By this time
he was not only out of funds, but out of confidence in his scheme for
making a fortune. In attempting to put his mill in operation, some of
the machinery gave way, and the same result happened at the next
trial. Thus expense was added to expense, and delay to delay. In the
mean time, the owner of the other mill had been spurred on by the
approaching competition, to increase its capacity, and was turning
out lumber so fast as to cause a reduction in the price.
So soon as Claxton became aware of the fact that Ellison’s suit
had come to a favorable termination, he conceived the idea of
getting off upon the young artist his bad bargain with as little loss to
himself as possible, and he had this purpose in his mind when he
congratulated him so warmly on his release from the perplexity and
uncertainty of the law.
“Trees standing in the forest, and lumber piled up ready for use
in building,” said Ellison, in reply to Claxton’s suggestion, “are very
different things.”
“Any man knows that. But, in the conversion of the trees into
lumber, lies the means of wealth. There is not an acre of your land
that will not yield sufficient lumber to bring three hundred dollars in
the market.”
“Are you certain of that?” inquired Ellison.
“I know it. The tract is very heavily timbered.”
“Three hundred dollars to the acre,” said Ellison, musing; “four
hundred acres—three times four are twelve. That would make the
lumber on the whole four hundred acres worth over a hundred
thousand dollars!”
“I know it would. And you may rest assured that the estimate is
not high. I only wish I had your chances for a splendid fortune.”
“How is this lumber to be made available?” asked Ellison.
“Cut and manufacture it yourself. You’ll find that a vast deal more
profitable than painting pictures. You can see that this is one of the
best situated towns in the West. The supply of lumber has always
been inadequate for building purposes, and, in consequence, its
prosperity has been retarded. Reduce the price by a full supply, and
houses will go up as by magic, and the value of property rise in all
directions. At present, you could not get over fifteen dollars an acre
for your land if you were to throw it into market. But go to work and
clear it gradually, sawing up the timber into building materials, and,
in ten years, such will be the prosperity of the place, growing out of
the very fact of a full supply of cheap lumber, that every acre will
command fifty dollars.”
The mind of the young man caught eagerly at this suggestion.
He held long interviews with Claxton, who made estimates of various
kinds for him, and gave him mathematics for every thing. They rode
out to the land together, and there it was demonstrated, to a
certainty, that at least seven hundred dollars worth of timber, instead
of three hundred, could be obtained from every acre. Ellison saw
himself worth his hundred thousand dollars, and as happy as such a
realization of his hopes could make him. He went with Claxton to his
mill, where the operation of every thing was fully explained to his
most perfect satisfaction. Even in this enterprise a fortune was to be
made, notwithstanding Claxton had no land of his own heavily
timbered, and would have to pay at least two dollars for every log
brought to his mill, which stood on the river bank. This site had been
chosen because of the facilities it afforded for getting the raw
material which could be floated down from above.
Of all this the young man talked constantly to his wife, and with
a degree of confidence and enthusiasm that half won her cooler and
less sanguine mind over to his views. She did not, however, like
Claxton. Her woman’s true instinct perceived the quality of his mind;
and she therefore had little confidence in him. In suggesting this,
her husband’s reply was,
“I don’t take any thing on his recommendation. I look at facts
and figures, and they cannot lie.”
There was something unanswerable in this; yet it did not satisfy
the mind of Clara.
When Ellison talked to others of what was in his mind, some
listened to what he said in silence; some shrugged their shoulders,
and some said it wouldn’t do. He had been forewarned of this
skepticism by Claxton, and was therefore prepared for it. He well
understood that the people lacked true, far-seeing enterprise; were,
in fact, half asleep! All objections, therefore, that were urged,
rebounded from his mind without producing any rational impression.
He had already picked out a spot for the location of his mill, and
was obtaining estimates for its construction, when Claxton called on
him one day, with a letter in his hand, which he said he had just
received from Cincinnati. It was from a brother who was engaged in
the river trading business, and who owned three large steamboats.
He had already made a fortune. But ill health had come upon him,
and he found it necessary to retire in part from the active duties
which had absorbed his attention for years. To his brother he offered
most tempting inducements to give up his saw-mill scheme, unite
with him, and take the active control of every thing. “If,” said the
letter, “you have any difficulty in finding a person in your stupid
place with enterprise enough to take your mill off of your hands, I
know a man here who will relieve you; but he will want time on
nearly the whole amount of the purchase. He is perfectly safe,
however, possessing a large amount of property.”
Of course, Mr. Claxton, having taken a particular fancy to Ellison,
and being anxious to put him fairly in the road to fortune, offered
him the mill at cost; and Ellison, without asking the advice of any
one—being fully impressed with the belief that he knew his own
business, and had sense enough to understand a plain proposition
when presented, immediately closed with the offer. The price asked
was exactly cost, and to determine what this was, the bills for every
thing were exhibited and taken as the basis of valuation. According
to these the mill had cost six thousand dollars. And for this sum,
Claxton generously consented to sell the entire concern, with all
prospective benefits, to his young friend. The amount of cash to be
paid down was three thousand dollars, and for the balance, notes of
six, nine, and twelve months were to be given, secured by mortgage
on the four hundred acres of land.
When matters assumed this aspect, Clara, who, strangely enough
to the mind of Alfred, appeared to like Claxton less and less every
day, suggested many doubts, and proposed that the matter should
be submitted to three old residents of the place, and their advice
taken as conclusive. But Alfred objected to this. They were plodders,
he said, in an old beaten track, where, like horses in a mill, they had
gone round and round until they were blind. They would, of course,
suggest a thousand doubts and difficulties, all of which he had
already solved. There was no aspect of the case in which he had not
viewed it, and he understood all the bearings better than any one
else.
“He is a poor sort of a man who cannot lay his course in life, and
steer safely by force of his own intelligence,” said the young man,
proudly.
Clara, however, was not satisfied; but having had some
experience in regard to her husband’s sensitiveness when any
question touching their property came up, she was afraid to say a
great deal in opposition to a purpose that was so fully formed as to
admit of no check without painful disturbance. So she permitted him
to take his own way, neither approving nor objecting.
Alfred understood, however, from his wife’s manner, that she had
little confidence in the new business upon which he was about
entering.
“Happily, I will disappoint her fears,” was his consoling and
strengthening reflection. “When her little property has swelled in
value to fifty or sixty thousand dollars, how different will be her
feelings! She will then understand the character of her husband
better—will know that he is no common man.”
With a presentiment of coming trouble, Clara saw their stock
sold, and three thousand dollars paid over to Claxton; but she
appeared to acquiesce in the transaction so entirely, that Alfred was
deceived as to her real feelings.
[To be continued.
THE PRIZE SECURED.
Engraved expressly for Graham’s Magazine
THE PIRATE.
———
BY HENRY B. HIRST.
———

Twelve hours along the glowing strand


The sunlight, like a flame, hath lain;
The surf is swelling on the sand,
And day is on the wane;
And, like a shadow on the shore,
The pallid plover winnows by,
And, like a ghost’s, the heron’s cry
Rises above the breakers’ roar.
And eddies down the sky.

Who saw her gliding from the stocks


Would know my gallant brigantine?
The granite teeth of rugged rocks
Have torn my ocean queen:
A royal ransom under deck,
The slave of every wave, she lies
Never, ah, nevermore to rise,
A helpless hulk—a crumbling wreck —
Before my dying eyes.
Alone! alone! alas! alone!
Not one of those who swayed the wave
Survives, to hear my dying moan,
Or give his chief a grave.
No, no, not one; alone I tread
These desolate, desert sands—alone,
Where, in the moon, as they were thrown,
My merry men lie, cold and dead
And motionless as stone.

Night after night, along the sea,


In maiden modesty of mien,
Glides, gazing mournfully on me,
My gentle Geraldine.
Her glances pierce my penitent heart,
As like a statued saint she stands —
A seraph from those unknown lands
To which my soul must soon depart,
Freed from its fleshy bands.

Sweet Geraldine! her beauty fell


On sense and soul, like light from heaven;
My heart looked up, like Dives from hell,
And prayed to be forgiven;
Love swam within her lustrous eyes,
Played in her shadowy hair.
Moved in her more than queenly air,
And floated on her silver sighs —
To drown me with despair.
O, woful day! O, woful hour!
That told me that my hopes were vain;
I felt, that second, centuries
Of agonizing pain!
Hope, tremulous with feverous fears,
Unclasped her wings, and fled;
I stood, like one whose dearest dead
Lies on the trestles—steeped in tears —
Heaven’s judgment on my head.

Why did she hate me! Wherefore blight


My penitent heart with piercing scorn?
My better angel took her flight
Despairing and forlorn:
The Fiend, who stood exulting by,
Reclaimed his trembling slave;
God saw, but would not stoop to save
The struggling wretch who dared defy
His laws, on land and wave.

O, Geraldine, I see thee fly,


Despairing, from my accursed hands:
“Better my bones should bleach,” thy cry,
“On savagest of strands
Than that my fatal charms should cause
My never—never-dying shame;
Better, O, villain, virtuous fame
With death, than life, when human laws,
And God’s, accuse my name!”
I see again thy mute, white face,
Thy pallid cheeks and bloodless lips,
Thine eyes, that shone like stars in space,
Rayless with shame’s eclipse —
As flying, ghost-like, through the night,
Fearing death less than me,
Thy heart went out beneath the sea:
An angel soul that night took flight,
A martyr ceased to be!

I walked in blood, I swam in wine,


Until my desperate, daring crew
Trembled at guilt so great as mine:
The unbelieving Jew
Who smote his God was white as snow
To that which I became;
So black was I, so steeped in shame,
The very fiends, who writhed below,
Howled when they heard my name.

Nature gave way: when I awoke


The sky was black, the sea was white;
Day, that long since had dimly broke,
Was little more than night;
And madly struggling with the waves
Careered my gallant craft;
My crew were pale, I only laughed,
And coarsely cursed the drunken knaves
Who, full of wine, still quaffed.
Night came; my men lay sunk in sleep;
I only trod the silent deck:
God’s anger walked the boisterous deep,
But little did I reck;
When in the storm, before my eyes,
My memory’s virgin queen,
The dead, the sainted Geraldine,
Stood calmly pointing to the skies,
Madonna-like in mien.

I waved her from me, and she waned;


I saw not, know not, how, or where;
A single pitying look she deigned,
Then, vanished into air.
Then came a sudden shock and crash:
In frantic haste I clasped
A fragment of a shattered mast;
I saw the boiling breakers flash,
And sense and memory passed.

When I revived, the noon-day sun


Lay swooning on the sultry sand:
I was the only human one
That ever touched the strand.
The very birds that sported round
Screamed when they neared the shore;
The trackless sands were gray and hoar;
Nor shrub, nor grass relieved the ground,
Which nothing living bore.
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!

ebookultra.com

You might also like