100% found this document useful (1 vote)
24 views

AI algorithms data structures and idioms in Prolog Lisp and Java 6th Edition George F. Luger - Download the full ebook set with all chapters in PDF format

The document provides links to download the full version of 'AI Algorithms, Data Structures, and Idioms in Prolog, Lisp, and Java' by George F. Luger, along with several other recommended ebooks and textbooks. It includes detailed information about the book's content, structure, and various programming paradigms covered. Additionally, it lists multiple editions of related works by different authors available for download on ebookultra.com.

Uploaded by

aouidialidia64
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)
24 views

AI algorithms data structures and idioms in Prolog Lisp and Java 6th Edition George F. Luger - Download the full ebook set with all chapters in PDF format

The document provides links to download the full version of 'AI Algorithms, Data Structures, and Idioms in Prolog, Lisp, and Java' by George F. Luger, along with several other recommended ebooks and textbooks. It includes detailed information about the book's content, structure, and various programming paradigms covered. Additionally, it lists multiple editions of related works by different authors available for download on ebookultra.com.

Uploaded by

aouidialidia64
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/ 51

Visit https://ebookultra.

com to download the full version and


explore more ebooks or textbooks

AI algorithms data structures and idioms in Prolog


Lisp and Java 6th Edition George F. Luger

_____ Click the link below to download _____


https://ebookultra.com/download/ai-algorithms-data-
structures-and-idioms-in-prolog-lisp-and-java-6th-edition-
george-f-luger/

Explore and download more ebooks or textbooks at ebookultra.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Data Structures and Algorithms in Java 6th Edition Michael


T. Goodrich

https://ebookultra.com/download/data-structures-and-algorithms-in-
java-6th-edition-michael-t-goodrich/

Artificial Intelligence Structures and Strategies for


Complex Problem Solving 6th Edition George F. Luger

https://ebookultra.com/download/artificial-intelligence-structures-
and-strategies-for-complex-problem-solving-6th-edition-george-f-luger/

Data Structures and Algorithms in Java 4th Edition Michael


T. Goodrich

https://ebookultra.com/download/data-structures-and-algorithms-in-
java-4th-edition-michael-t-goodrich/

Learning F Functional Data Structures and Algorithms 1st


Edition Masood

https://ebookultra.com/download/learning-f-functional-data-structures-
and-algorithms-1st-edition-masood/
Artificial Intelligence Structures and Strategies for
Complex Problem Solving 5th Edition George F. Luger

https://ebookultra.com/download/artificial-intelligence-structures-
and-strategies-for-complex-problem-solving-5th-edition-george-f-luger/

Java Collections An Introduction to Abstract Data Types


Data Structures and Algorithms 1st Edition David A. Watt

https://ebookultra.com/download/java-collections-an-introduction-to-
abstract-data-types-data-structures-and-algorithms-1st-edition-david-
a-watt/

Growing Algorithms and Data Structures 4th Edition David


Scuse

https://ebookultra.com/download/growing-algorithms-and-data-
structures-4th-edition-david-scuse/

Data Structures Algorithms In Go 1st Edition Hemant Jain

https://ebookultra.com/download/data-structures-algorithms-in-go-1st-
edition-hemant-jain/

Learning JavaScript Data Structures and Algorithms 2nd


Edition Loiane Groner

https://ebookultra.com/download/learning-javascript-data-structures-
and-algorithms-2nd-edition-loiane-groner/
AI algorithms data structures and idioms in Prolog Lisp
and Java 6th Edition George F. Luger Digital Instant
Download
Author(s): George F. Luger, William A. Stubblefield
ISBN(s): 9780136070474, 0136070477
Edition: 6
File Details: PDF, 2.27 MB
Year: 2009
Language: english
Luger_all_wcopyright_COsfixed.pd2 2 5/15/2008 6:34:39 PM
AI Algorithms, Data Structures, and
Idioms in Prolog, Lisp, and Java

Luger_all_wcopyright_COsfixed.pd1 1 5/15/2008 6:34:39 PM


Luger_all_wcopyright_COsfixed.pd2 2 5/15/2008 6:34:39 PM
AI Algorithms, Data Structures, and
Idioms in Prolog, Lisp, and Java

George F. Luger
William A. Stubblefield

Luger_all_wcopyright_COsfixed.pd3 3 5/15/2008 6:34:39 PM


Executive Editor Michael Hirsch
Acquisitions Editor Matt Goldstein
Editorial Assistant Sarah Milmore
Managing Editor Jeff Holcomb
Digital Assets Manager Marianne Groth
Senior Media Producer Bethany Tidd
Marketing Manager Erin Davis
Senior Author Support/
Technology Specialist Joe Vetere
Senior Manufacturing Buyer Carol Melville
Text Design, Composition, and Illustrations George F Luger
Cover Design Barbara Atkinson
Cover Image © Tom Barrow

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and Addison-Wesley was aware of a
trademark claim, the designations have been printed in initial caps or all caps.

Copyright © 2009 Pearson Education, Inc. All rights reserved. No part of this publication may be
reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic,
mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher.
Printed in the United States of America. For information on obtaining permission for use of material in this
work, please submit a written request to Pearson Education, Inc., Rights and Contracts Department, 501
Boylston Street, Suite 900, Boston, MA 02116, fax (617) 671-3447, or online at
http://www.pearsoned.com/legal/permissions.htm.

ISBN-13: 978-0-13-607047-4
ISBN-10: 0-13-607047-7

1 2 3 4 5 6 7 8 9 10—OPM—12 11 10 09 08

Luger_copyright.pdf 1 5/15/2008 6:02:23 PM


Contents
Preface ix

Part I Language Idioms and the Master Programmer 1


Chapter 1 Idioms, Patterns, and Programming 3
1.1 Introduction: Idioms and Patterns 3
1.2 Selected Examples of Language Idioms 6
1.3 A Brief History of Three Programming Paradigms 11
1.4 A Summary of Our Task 15

Part II Programming in Prolog 17


Chapter 2 Prolog: Representation 19
2.1 Introduction: Logic-Based Representation 19
2.2 Prolog Syntax 20
2.3 Creating, Changing, and Tracing a Prolog Computation 24
2.4 Lists and Recursion in Prolog 25
2.5 Structured Representation and Inheritance Search 28
Exercises 32

Chapter 3 Abstract Data Types and Search 33


3.1 Introduction 33
3.2 Using cut to Control Search in Prolog 36
3.3 Abstract Data Types (ADTs) in Prolog 38
Exercises 42

Chapter 4 Depth- Breadth-, and Best-First Search 43


4.1 Production System Search in Prolog 43
4.2 A Production System Solution of the FWGC Problem 46
4.3 Designing Alternative Search Strategies 52
Exercises 58

Chapter 5 Meta-Linguistic Abstraction, Types, and Meta-Interpreters 59


5.1 Meta-Interpreters, Types, and Unification 59
5.2 Types in Prolog 61
5.3 Unification, Variable Binding, and Evaluation 64
Exercises 68
v

Luger_all_wcopyright_COsfixed.pd5 5 5/15/2008 6:34:39 PM


vi Contents

Chapter 6 Three Meta-Interpreters: Prolog in Prolog, EXSHELL, and a


Planner 59
6.1 An Introduction to Meta-Interpreters: Prolog in Prolog 69
6.2 A Shell for a Rule-Based System 73
6.3 A Prolog Planner 82
Exercises 85

Chapter 7 Machine Learning Algorithms in Prolog 87


7.1 Machine Learning: Version Space Search 87
7.2 Explanation Based Learning in Prolog 100
Exercises 106

Chapter 8 Natural Language Processing in Prolog 107


8.1 Natural Language Understanding 107
8.2 Prolog Based Semantic Representation 108
8.3 A Context-Free Parser in Prolog 111
8.4 Probabilistic Parsers in Prolog 114
8.5 A Context-Sensitive Parser in Prolog 119
8.6 A Recursive Descent Semantic Net Parser 120
Exercises 123

Chapter 9 Dynamic Programming and the Earley Parser 125


9.1 Dynamic Programming Revisited 125
9.2 The Earley Parser 126
9.3 The Earley Parser in Prolog 134
Exercises 139

Chapter 10 Prolog: Final Thoughts 141


10.1 Towards a Procedural Semantics 141
10.2 Prolog and Automated Reasoning 144
10.3 Prolog Idioms, Extensions, and References 145

Part III Programming in Lisp 149


Chapter 11 S-Expressions, the Syntax of Lisp 151
11.1 Introduction to Symbol Expressions 151
11.2 Control of Lisp Evaluation 154
11.3 Programming in Lisp: Creating New Functions 156
11.4 Program Control: Conditionals and Predicates 157
Exercises 160

Luger_all_wcopyright_COsfixed.pd6 6 5/15/2008 6:34:39 PM


Contents vii

Chapter 12 Lists and Recursive Search 161

12.1 Functions, Lists, and Symbolic Computing 161


12.2 Lists as Recursive Structures 163
12.3 Nested Lists, Structure, and car/cdr Recursion 166
Exercises 168

Chapter 13 Variables, Datratypes, and Search 171


13.1 Variables and Datatypes 171
13.2 Search: The Farmer, Wolf, Goat, and Cabbage Problem 177
Exercises 182

Chapter 14 Higher-Order Functions and Flexible Search 185


14.1 Higher-Order Functions and Abstraction 185
14.2 Search Strategies in Lisp 189
Exercises 193

Chapter 15 Unification and Embedded Languages in Lisp 195


15.1 Introduction 195
15.2 Interpreters and Embedded Languages 203
Exercises 205

Chapter 16 Logic programming in Lisp 207


16.1 A Simple Logic Programming Language 207
16.2 Streams and Stream Processing 209
16.3 A Stream-Based logic Programming Interpreter 211
Exercises 217

Chapter 17 Lisp-shell: An Expert System Shell in Lisp 219


17.1 Streams and Delayed Evaluation 219
17.2 An Expert System Shell in Lisp 223
Exercises 232

Chapter 18 Semantic Networks, Inheritance, and CLOS 233


18.1 Semantic nets and Inheritance in Lisp 233
18.2 Object-Oriented Programming Using CLOS 237
18.3 CLOS Example: A Thermostat Simulation 244
Exercises 250

Chapter 19 Machine Learning in Lisp 251


19.1 Learning: The ID3 Algorithm 251
19.2 Implementing ID3 259

Luger_all_wcopyright_COsfixed.pd7 7 5/15/2008 6:34:39 PM


viii Contents

Exercises 266

Chapter 20 Lisp: Final Thoughts 267

Part IV Programming in Java 269


Chapter 21 Java, Representation and Object-Oriented Programming 273
21.1 Introduction to O-O Representation and Design 273
21.2 Object Orientation 274
21.3 Classes and Encapsulation 275
21.4 Polymorphism 276
21.5 Inheritance 277
21.6 Interfaces 280
21.7 Scoping and Access 282
21.8 The Java Standard Library 283
21.9 Conclusions: Design in Java 284
Exercises 285

Chapter 22 Problem Spaces and Search 287


21.1 Abstraction and Generality in Java 287
21.2 Search Algorithms 288
21.3 Abstracting Problem States 292
21.4 Traversing the Solution Space 295
21.5 Putting the Framework to Use 298
Exercises 303

Chapter 23 Java Representation for Predicate Calculus and Unification 305


23.1 Introduction to the Task 305
23.2 A Review of the Predicate Calculus and Unification 307
23.3 Building a Predicate Calculus Problem Solver in Java 310
23.4 Design Discussion 320
23.5 Conclusions: Mapping Logic into Objects 322
Exercises 323

Chapter 24 A Logic-Based Reasoning System 325


24.1 Introduction 325
24.2 Reasoning in Logic as Searching an And/Or Graph 325
24.3 The Design of a Logic-Based Reasoning System 329
24.4 Implementing Complex Logic Expressions 330
24.5 Logic-Based Reasoning as And/Or Graph Search 335
24.6 Testing the Reasoning System 346

Luger_all_wcopyright_COsfixed.pd8 8 5/15/2008 6:34:40 PM


Contents ix

24.7 Design Discussion 348


Exercises 350

Chapter 25 An Expert System Shell 351


25.1 Introduction: Expert Systems 351
25.2 Certainty Factors and the Unification Problem Solver 352
25.3 Adding User Interactions 358
25.4 Design Discussion 360
Exercises 361

Chapter 26 Case Studies: JESS and other Expert System Shells in Java 363
26.1 Introduction 363
26.2 JESS 363
26.3 Other Expert system Shells 364
26.4 Using Open Source Tools 365

Chapter 27 ID3: Learning from Examples 367


27.1 Introduction to Supervised Learning 367
27.2 Representing Knowledge as Decision Trees 367
27.3 A Decision Tree Induction program 370
27.4 ID3: An Information Theoretic Tree Induction Algorithm 385
Exercises 388

Chapter 28 Genetic and Evolutionary Computing 389


28.1 Introduction 389
28.2 The Genetic Algorithm: A First Pass 389
28.3 A GA Java Implementation in Java 393
28.4 Conclusion: Complex Problem Solving and Adaptation 401
Exercises 401

Chapter 29 Case Studies: Java Machine Learning Software Available on the


Web 403
29.1 Java Machine Learning Software 403

Chapter 30 The Earley Parser: Dynamic Programming in Java 405


30.1 Chart Parsing 405
30.2 The Earley Parser: Components 406
30.3 The Earley Parser: Java Code 408
30.4 The Completed Parser 414
30.5 Generating Parse Trees from Charts and Grammar Rules 419
Exercises 422

Luger_all_wcopyright_COsfixed.pd9 9 5/15/2008 6:34:40 PM


x Contents

Chapter 31 Case Studies: Java Natural Language Tools on the Web 423
31.1 Java Natural Language Processing Software 423
31.2 LingPipe from the University of Pennsylvania 423
31.3 The Stanford Natural Language Processing Group Software 425
31.4 Sun’s Speech API 426

Part V Model Building and the Master Programmer 429

Chapter 32 Conclusion: The Master Programmer 431


32.1 Paradigm-Based Abstractions and Idioms 431
32.2 Programming as a Tool for Exploring Problem Domains 433
32.3 Programming as a Social Activity 434
32.4 Final Thoughts 437

Bibliography 439

Index 443

Luger_all_wcopyright_COsfixed.pd10 10 5/15/2008 6:34:40 PM


Preface
What we have to learn to do
We learn by doing…

- Aristotle, Ethics

Why Another Writing a book about designing and implementing representations and
Programming search algorithms in Prolog, Lisp, and Java presents the authors with a
Language number of exciting opportunities.
Book?
The first opportunity is the chance to compare three languages that give
very different expression to the many ideas that have shaped the evolution
of programming languages as a whole. These core ideas, which also
support modern AI technology, include functional programming, list
processing, predicate logic, declarative representation, dynamic binding,
meta-linguistic abstraction, strong-typing, meta-circular definition, and
object-oriented design and programming. Lisp and Prolog are, of course,
widely recognized for their contributions to the evolution, theory, and
practice of programming language design. Java, the youngest of this trio, is
both an example of how the ideas pioneered in these earlier languages
have shaped modern applicative programming, as well as a powerful tool
for delivering AI applications on personal computers, local networks, and
the world wide web.
The second opportunity this book affords is a chance to look at Artificial
Intelligence from the point of view of the craft of programming. Although
we sometimes are tempted to think of AI as a theoretical position on the
nature of intelligent activity, the complexity of the problems AI addresses
has made it a primary driver of progress in programming languages,
development environments, and software engineering methods. Both Lisp
and Prolog originated expressly as tools to address the demands of
symbolic computing. Java draws on object-orientation and other ideas that
can trace their roots back to AI programming. What is more important, AI
has done much to shape our thinking about program organization, data
structures, knowledge representation, and other elements of the software
craft. Anyone who understands how to give a simple, elegant formulation
to unification-based pattern matching, logical inference, machine learning
theories, and the other algorithms discussed in this book has taken a large
step toward becoming a master programmer.
The book’s third, and in a sense, unifying focus lies at the intersection of
these points of view: how does a programming language’s formal structure
interact with the demands of the art and practice of programming to

xi

Luger_all_wcopyright_COsfixed.pd11 11 5/15/2008 6:34:40 PM


xii Preface

create the idioms that define its accepted use. By idiom, we mean a set of
conventionally accepted patterns for using the language in practice.
Although not the only way of using a language, an idiom defines patterns
of use that have proven effective, and constitute a common understanding
among programmers of how to use the language. Programming language
idioms do much to both enable, as well as support, ongoing
communication and collaboration between programmers.
These, then, are the three points of view that shape our discussion of AI
programming. It is our hope that they will help to make this book more
than a practical guide to advanced programming techniques (although it is
certainly that). We hope that they will communicate the intellectual depth
and pleasure that we have found in mastering a programming language
and using it to create elegant and powerful computer programs.
The Design of There are five sections of this book. The first, made up of a single chapter,
this Book lays the conceptual groundwork for the sections that follow. This first
chapter provides a general introduction to programming languages and
style, and asks questions such as “What is a master programmer?” What is a
programming language idiom?,” and “How are identical design patterns
implemented in different languages?” Next, we introduce a number of
design patterns specific to supporting data structures and search strategies
for complex problem solving. These patterns are discussed in a “language
neutral” context, with pointers to the specifics of the individual
programming paradigms presented in the subsequent sections of our
book. The first chapter ends with a short historical overview of the
evolution of the logic-based, functional, and object-oriented approaches to
computer programming languages.
Part II of this book presents Prolog. For readers that know the rudiments
of first-order predicate logic, the chapters of Part II can be seen as a
tutorial introduction to Prolog, the language for programming in logic.
For readers lacking any knowledge of the propositional and predicate
calculi we recommend reviewing an introductory textbook on logic.
Alternatively, Luger (2005, Chapter 2) presents a full introduction to both
the propositional and predicate logics. The Luger introduction includes a
discussion, as well as a pseudo code implementation, of unification, the
pattern-matching algorithm at the heart of the Prolog engine.
The design patterns that make up Part II begin with the “flat” logic-based
representation for facts, rules, and goals that one might expect in any
relational data base formalism. We next show how recursion, supported by
unification-based pattern matching, provides a natural design pattern for
tree and graph search algorithms. We then build a series of abstract data
types, including sets, stacks, queues, and priority queues that support
patterns for search. These are, of course, abstract structures, crafted for
the specifics of the logic-programming environment that can search across
state spaces of arbitrary content and complexity. We then build and
demonstrate the “production system” design pattern that supports rule
based programming, planning, and a large number of other AI
technologies. Next, we present structured representations, including

Luger_all_wcopyright_COsfixed.pd12 12 5/15/2008 6:34:40 PM


Preface xiii

semantic networks and frame systems in Prolog and demonstrate


techniques for implementing single and multiple inheritance
representation and search. Finally, we show how the Prolog design
patterns presented in Part II can support the tasks of machine learning
and natural language understanding.
Lisp and functional programming make up Part III. Again, we present the
material on Lisp in the form of a tutorial introduction. Thus, a
programmer with little or no experience in Lisp is gradually introduced to
the critical data structures and search algorithms of Lisp that support
symbolic computing. We begin with the (recursive) definition of symbol-
expressions, the basic components of the Lisp language. Next we present
the “assembly instructions” for symbol expressions, including car, cdr, and
cons. We then assemble new patterns for Lisp with cond and defun.
Finally, we demonstrate the creation and/or evaluation of symbol
expressions with quote and eval. Of course, the ongoing discussion of
variables, binding, scope, and closures is critical to building more complex
design patterns in Lisp.
Once the preliminary tools and techniques for Lisp are presented, we
describe and construct many of the design patterns seen earlier in the
Prolog section. These include patterns supporting breadth-first, depth-
first, and best-first search as well as meta-interpreters for rule-based
systems and planning. We build and demonstrate a recursion-based
unification algorithm that supports a logic interpreter in Lisp as well as a
stream processor with delayed evaluation for handling potentially infinite
structures. We next present data structures for building semantic networks
and object systems. We then present the Common Lisp Object system
(CLOS) libraries for building object and inheritance based design patterns.
We close Part III by building design patterns that support decision-tree
based machine learning.
Java and its idioms are presented in Part IV. Because of the complexities
of the Java language, Part IV is not presented as a tutorial introduction to
the language itself. It is expected that the reader has completed at least an
introductory course in Java programming, or at the very least, has seen
object-oriented programming in another applicative language such as
C++, C#, or Objective C. But once we can assume a basic understanding
of Java tools, we do provide a tutorial introduction to many of the design
patterns of the language.
The first chapter of Part IV, after a brief overview of the origins of Java,
goes through many of the features of an object-oriented language that will
support the creation of design patterns in that environment. These
features include the fundamental data structuring philosophy of
encapsulation, polymorphism, and inheritance. Based on these concepts
we briefly address the analysis, iterative design, programming and test
phases for engineering programs. After the introductory chapter we begin
pattern building in Java, first considering the representation issue and how
to represent predicate calculus structures in Java. This leads to building

Luger_all_wcopyright_COsfixed.pd13 13 5/15/2008 6:34:41 PM


xiv Preface

patterns that support breadth-first, depth-first, and best-first search. Based


on patterns for search, we build a production system, a pattern that
supports the rule-based expert system. Our further design patterns
support the application areas of natural language processing and machine
learning. An important strength that Java offers, again because of its
object-orientation and modularity is the use of public domain (and other)
libraries available on the web. We include in the Java section a number of
web-supported AI algorithms, including tools supporting work in natural
language, genetic and evolutionary programming (a-life), natural language
understanding, and machine learning (WEKA).
The final component of the book, Part V, brings together many of the
design patterns introduced in the earlier sections. It also allows the authors
to reinforce many of the common themes that are, of necessity,
distributed across the various components of the presentation, We
conclude with general comments supporting the craft of programming.
Using this Book This book is designed for three primary purposes. The first is as a
programming language component of a general class in Artificial
Intelligence. From this viewpoint, the authors see as essential that the AI
student build the significant algorithms that support the practice of AI.
This book is designed to present exactly these algorithms. However, in the
normal lecture/lab approach taken to teaching Artificial Intelligence at the
University level, we have often found that it is difficult to cover more than
one language per quarter or semester course. Therefore we expect that the
various parts of this material, those dedicated to either Lisp, Prolog, or
Java, would be used individually to support programming the data
structures and algorithms presented in the AI course itself. In a more
advanced course in AI it would be expected that the class cover more than
one of these programming paradigms.
The second use of this book is for university classes exploring
programming paradigms themselves. Many modern computer science
departments offer a final year course in comparative programming
environments. The three languages covered in our book offer excellent
examples on these paradigms. We also feel that a paradigms course should
not be based on a rapid survey of a large number of languages while doing
a few “finger exercises” in each. Our philosophy for a paradigms course is
to get the student more deeply involved in fewer languages, and these
typically representing the declarative, functional, and object-oriented
approaches to programming. We also feel that the study of idiom and
design patterns in different environments can greatly expand the skill set
of the graduating student. Thus, our philosophy of programming is built
around the language idioms and design patterns presented in Part I and
summarized in Part V. We see these as an exciting opportunity for
students to appreciate the wealth and diversity of modern computing
environments. We feel this book offers exactly this opportunity.
The third intent of this book is to offer the professional programmer the
chance to continue their education through the exploration of multiple

Luger_all_wcopyright_COsfixed.pd14 14 5/15/2008 6:34:41 PM


Preface xv

programming idioms, patterns, and paradigms. For these readers we also


feel the discussion of programming idioms and design patterns presented
throughout our book is important. We are all struggling to achieve the
status of the master programmer.
We have built each chapter in this book to reflect the materials that would
be covered in either one or two classroom lectures, or about an hour’s
effort, if the reader is going through this material by herself. There are a
small number of exercises at the end of most chapters that may be used to
reinforce the main concepts of that chapter. There is also, near the end of
each chapter, a summary statement of the core concepts covered.
Acknowledg- First, we must thank several decades of students and colleagues at the
ments University of New Mexico. These friends not only suggested, helped
design, and tested our algorithms but have also challenged us to make
them better.
Second, we owe particular thanks to colleagues who wrote algorithms and
early drafts of chapters. These include Stan Lee, (PhD student at UNM)
for the Prolog chapter on Earley parsing, Breanna Ammons (MS in CS at
UNM) for the Java version of the Earley parser and along with Robert
Spurlock (CS undergraduate at UNM) the web-based NLP chapter, Paul
DePalma (Professor of CS at Gonzaga University) for the Java Genetic
Algorithms chapter, and Chayan Chakrabarti (MS in CS at UNM) for the
web-based machine learning chapter in Java
Third, there are several professional colleagues that we owe particular
debts. These include David MacQueen, University of Chicago, one of the
creators of SML, Manuel Hermenegildo, The Prince of Asturias Endowed
Chair of Computer Science at UNM and a designer of Ciao Prolog, Paul
De Palma, Professor of Computer Science at Gonzaga University, and
Alejandro Cdebaca, our friend and former student, who helped design
many of the algorithms of the Java chapters.
Fourth, we thank our friends at Pearson Education who have supported
our various creative writing activities over the past two decades. We
especially acknowledge our editors Alan Apt, Karen Mossman, Keith
Mansfield, Owen Knight, Simon Plumtree, and Matt Goldstein, along with
their various associate editors, proof readers, and web support personnel.
We also thank our wives, children, family, and friends; all those that have
made our lives not just survivable, but intellectually stimulating and
enjoyable.
Finally, to our readers; we salute you: the art, science, and practice of
programming is great fun, enjoy it!

GL
BS
July 2008
Albuquerque

Luger_all_wcopyright_COsfixed.pd15 15 5/15/2008 6:34:41 PM


xvi Preface

Luger_all_wcopyright_COsfixed.pd16 16 5/15/2008 6:34:41 PM


PART I: Language Idioms and the
Master Programmer

all good things - trout as well as eternal salvation - come by grace and grace comes by art and art does not
come easy…

- Norman Maclean, (1989) A River Runs Through It

Language and In defining a programming language idiom, an analogy with natural


Idioms
language use might help. If I ask a friend, “Do you know what time it is?”
or equivalently “Do you have a watch?”, I would be surprised if she simply
said “yes” and turned away. These particular forms for asking someone for
the time of day are idiomatic in that they carry a meaning beyond their
literal interpretation. Similarly, a programming language idiom consists of
those patterns of use that good programmers accept as elegant, expressive
of their design intent, and that best harness the language’s power. Good
idiomatic style tends to be specific to a given language or language
paradigm: the way experienced programmers organize a Prolog program
would not constitute accepted Java style.
Language idioms serve two roles. The first is to enhance communication
between programmers. As experienced programmers know, we do not
simply write code for a compiler; we also write it for each other. Writing in
a standard idiom makes it easier for other people to understand our intent,
and to maintain and/or extend our code. Second, a language’s idiom helps
us to make sure we fully use the power the language designers have
afforded us. People design a language with certain programming styles in
mind. In the case of Java, that style was object-oriented programming, and
getting full benefit of such Java features as inheritance, scoping, automatic
garbage collection, exception handling, type checking, packages, interfaces,
and so forth requires writing in an object-oriented idiom. A primary goal of
this book is to explore and give examples of good idioms in three diverse
language paradigms: the declarative (logic-based), functional, and object-
oriented.
The Master The goal of this book is to develop the idea and describe the practice of
Programmer
the master programmer. This phrase carries a decidedly working class
connotation, suggesting the kind of knowledge and effort that comes
through long practice and the transmission of tools and skills from master
to student through the musty rituals of apprenticeship. It certainly suggests
something beyond the immaculate formalization that we generally associate
with scientific disciplines. Indeed, most computer science curricula

Luger_all_wcopyright_COsfixed.pd17 17 5/15/2008 6:34:41 PM


2 Part I Introduction

downplay this craft of programming, favoring discussions of computability


and complexity, algorithms, data structures, and the software engineer’s
formalist longings. In reality, the idea of programming as a craft that
demands skill and dedication is widely accepted in practical circles. Few
major successful programming projects have existed that did not owe
significant components of that success to the craftsmanship of such
individuals.
But, what then, do master programmers know?
The foundation of a master programmer’s knowledge is a strong
understanding of the core domains of computer science. Although working
programmers may not spend much (or any) time developing and
publishing theorems, they almost always have a deep, intuitive grasp of
algorithms, data structures, logic, complexity, and other aspects of the
theory of formal systems. We could compare this to a master welder’s
understanding of metallurgy: she may not have a theoretician’s grasp of
metallic crystalline structure, but her welds do not crack. This book
presumes a strong grounding in these computer science disciplines.
Master programmers also tend to be language fanatics, exhibiting a fluency
in several programming languages, and an active interest in anything new
and unusual. We hope that our discussion of three major languages will
appeal to the craftsman’s fascination with their various tools and
techniques. We also hope that, by contrasting these three major languages
in a sort of “comparative language” discussion, we will help programmers
refine their understanding of what a language can provide, and the needs
that continue to drive the evolution of programming languages.

Luger_all_wcopyright_COsfixed.pd18 18 5/15/2008 6:34:42 PM


Other documents randomly have
different content
He felt happier than he had done ever since the day in the forest
when the name of Vassia Kazán had been said in his ear; he had
recovered his nerve, his self-command, his insouciance; he was once
more capable of honestly forgetting that he was anything besides
the great gentleman he appeared. There was an additional
pungency for him in the fact of his mission being to Russia. He hated
the country as a renegade hates a religion he has abandoned. The
undying hereditary enmity which must always exist, sub rosa,
betwixt Austria and Russia was in accordance with the antagonism
he himself felt for every rood of the soil, for every syllable of the
tongue, of the Muscovite. He knew that Paul Zabaroff, his father's
legitimate son, was a mighty prince, a keen politician, a favourite
courtier at the Court of St. Petersburg. The prospect of himself
appearing at that Court as the representative of a great nation, with
the occasion and the power to meet Paul Zabaroff as an equal, and
defeat his most cherished intrigues, his most subtle projects, gave
an intensity to his triumph such as no mere social honours or
gratified ambition could alone have given him. If the minister had
searched the whole of the Austrian empire through, in all the ranks
of men he could have found no one so eager to serve the purpose
and the interests of his Imperial master against the rivalry of Russia,
as he found in one who had been born a naked moujik in the isba of
a Persian peasant.
Even though this distinction which was offered him would rest like all
else on a false basis, yet it intoxicated him, and would gratify his
desires to be something above and beyond the mere prince-consort
that he was. He knew that his talents were real, that his tact and
perception were unerring, that his power to analyse and influence
men was great. All these qualities he felt would enable him in a
public career to conquer admiration and eminence. He was not yet
old enough to be content to regard the future as a thing belonging
to his sons, nor had he enough philo-progenitiveness ever to do so
at any age.
'To return so to Russia!' he thought, with rapture. All the ambition
that had been in him in his college days at the Lycée Clovis, which
had never taken definite shape, partly from indolence and partly
from circumstance, and had not been satisfied even by the brilliancy
of his marriage, was often awakened and spurred by the greatness
of the social position of all those with whom he associated. In his
better moments be sometimes thought, 'I am only the husband of
the Countess von Szalras; I am only the father of the future lords of
Hohenszalras;' and the reflection that the world might regard him so
made him restless and ill at ease.
He knew that, being what he was, he would add to his crime tenfold
by acceptance of the honour offered to him. He knew that the more
prominent he was in the sight of men, the deeper would be his fall if
ever the truth were told. What gauge had he that some old school-
mate, dowered with as long a memory as Vàsàrhely's, might not
confront him with the same charge and challenge? True, this danger
had always seemed to him so remote that never since he had landed
at Romaris bay had he been troubled by any apprehension of it. His
own assured position, his own hauteur of bearing, his own perfect
presence of mind, would have always enabled him to brave safely
such an ordeal under the suspicion of any other than Vàsàrhely; with
any other he could have relied on his own coolness and courage to
have borne him with immunity through any such recognition.
Besides, he had always reckoned, and reckoned justly, that no one
would ever dare to insult the Marquis de Sabran with a suspicion
that could have no proof to sustain it. So he had always reasoned,
and events had justified his expectations and deductions.
This month that he now passed in Vienna was the proudest of his
life; not perhaps the happiest, for beneath his contentment there
was a jarring remembrance that he was deceiving a great sovereign
and his ministers. But he thrust this sting of conscience aside
whenever it touched him, and abandoned himself with almost
youthful gladness to the felicitations he received, the arrangements
he had to make, and the contemplation of the future before him.
The pleasures of the gay and witty city surrounded him, and he was
too handsome, too seductive, and too popular not to be sought by
women of all ranks, who rallied him on his long devotion to his wife,
and did their best to make him ashamed of constancy.
'What beasts we are!' he thought, as he left Damn's at the flush of
dawn, after a supper there which he had given, and which had
nearly degenerated into an orgie. 'Yet is it unfaithfulness to her? My
soul is always hers and my love.'
Still his conscience smote him, and he felt ashamed as he thought of
her proud frank eyes, of her noble trust in him, of her pure and lofty
life led there under the show summits of her hills.
He worshipped her, with all his life he worshipped her; a moment's
caprice, a mere fume and fever of senses surprised and astray, were
not infidelity to her. So he told himself, with such sophisms as men
most use when most they are at fault, as he walked home in the
rose of the daybreak to her great palace, which like all else of hers
was his.
As he ascended the grand staircase, with the escutcheon of the
Szalras repeated on the gilded bronze of its balustrade, a chill and a
depression stole upon him. He loved her with intensity and ardour
and truth, yet he had been disloyal to her; he had forgotten her, he
had been unworthy of her. What worth were all the women in the
world beside her? What did they seem to him now, those Delilahs
who had beguiled him? He loathed the memory of them; he
wondered at himself. He went through the great house slowly
towards his own rooms, pausing now and then, as though he had
never seen them before, to glance at some portrait, some stand of
arms, some banner commemorative of battle, some quiver, bow, and
pussikan taken from the Turk.
On his table he found a telegram sent from Lienz:
'I am so glad you are amused and happy. We are all well here.
(Signed) 'WANDA.'
No torrents of rebuke, no scenes of rage, no passion of reproaches
could have carried reproach to him like those simple words of
trustful affection.
'An angel of God should have descended to be worthy her!' he
thought.
The next evening there was a ball at the Hof. It was later in the
season than such things were usually, but the visit to the court of
the sovereign of a neighbouring nation had detained their majesties
and the nobility in Vienna. The ball was accompanied by all that
pomp and magnificence which characterise such festivities, and
Sabran, present at it, was the object of universal congratulation and
much observation, as the ambassador-designate to Russia.
Court dress became him, and his great height and elegance of
manner made him noticeable even in that brilliant crowd of notables.
All the greatest ladies distinguished him with their smiles, but he
gave them no more than courtesy. He saw only before the 'eye of
memory' his wife as he had seen her at the last court ball, with the
famous pearls about her throat, and her train of silver tissue sown
with pearls and looped up with white lilac.
'It is the flower I like best,' she had said to him. 'It brought me your
first love-message in Paris, do you remember? It said little; it was
very discreet, but it said enough!'
'You are always thinking of Wanda!' said the Countess Brancka to
him now, with a tinge of impatience in her tone.
He coloured a little, and said with that hauteur with which he always
repressed any passing jest at his love for his wife:
'When both one's duty and joy point the same way it is easy to
follow them in thought.'
'I hope you follow them in action too,' said Mdme. Brancka.
'If I do not, I am at least only responsible to Wanda.'
'Who would be a lenient judge you mean? said the Countess, with a
certain smile that displeased him. 'Do not be too sure; she is a von
Szalras. They are not agreeable persons when they are angered.'
'I have not been so unhappy as to see her so,' said Sabran coldly,
with a vague sense of uneasiness. As much as it is possible for a
man to dislike a woman who is very lovely, and young enough to be
still charming in the eyes of the world, he disliked Olga Brancka. He
had known her for many years in Paris, not intimately, but by force
of being in the same society, and, like many men who do not lead
very decent lives themselves, he frankly detested cocodettes.
'If we want these manners we have our lionnes,' he was wont to say,
at a time when Cochonette was seen every day behind his horses by
the Cascade, and it had been the height of the Countess Olga's
ambition at that time to be called like Cochonette. A certain
resemblance there was between the great lady and the wicked one;
they had the same small delicate sarcastic features, the same red
gold curls, the same perfect colourless complexion; but where
Cochonette had eyes of the slightest blue, the wife of Count Stefan
had the luminous piercing black eyes of the Muscovite physiognomy.
Still the likeness was there, and it made the sight of Mdme. Brancka
distasteful to him, since his memories of the other were far from
welcome. It was for Cochonette that he had broken the bank at
Monte Carlo, and into her lap that he had thrown all the gold
rouleaux at a time when in his soul he had already adored Wanda
von Szalras, and had despised himself for returning to the slough of
his old pleasures. It was Cochonette who had sold his secrets to the
Prussians, and brought them down upon him in the farmhouse
amongst the orchards of the Orléannais, whilst she passed safely
through, the German lines and across the frontier, laden with her
jewels and her valeurs of all kinds, saying in her teeth as she went:
'He will never see that Austrian woman again!' That had been the
end of all he had known of Cochonette, and a presentiment of
perfidy, of danger, of animosity always came over him whenever he
saw the joli petit minois which in profile was so like Cochonette's,
looking up from under the loose auburn curls that Mdme. Olga had
copied from her.
Olga Brancka now looked at him with some malice and with more
admiration; she was very pretty that night, blazing with diamonds;
and with her beautifully shaped person as bare as Court etiquette
would permit. In her red gold curls she had some butterflies in
jewels flashing all the colours of the rainbow and glowing like
sunbeams. There was such a butterfly, big as the great Emperor
moth, between her breasts, making their whiteness look like snow.
Instinctively Sabran glanced away from her. He felt an
étourdissement that irritated him. The movement did not escape her.
She took his arm.
'We will move about a little while,' she said. 'Let us talk of Wanda,
mon beau cousin; since you can think of no one else. And so you are
really going to Russia?'
'I believe so.'
'It will be a great sacrifice to her; any other woman would be in
paradise in St. Petersburg, but she will be wretched.'
'I hope not; if I thought so I would not go.'
'You cannot but go now; you have made your choice. You will be
happy enough. You will play again enormously, and Wanda has so
much money that if you lose millions it will not ruin her.'
'I shall certainly not play with my wife's money. I have never played
since my marriage.'
'For all that you will play in St. Petersburg. It is in the air. A saint
could not help doing it, and you are not a saint by nature, though
you have become one since marriage. But you know conversions by
marriage do not last. They are like compulsory confessions. They
mean nothing.'
'You are very malicious to-night, madame,' said Sabran, absently; he
was in no mood for banter, and was disinclined to take up her
challenge.
'Call me at least cousinette,' said Mdme. Olga; 'we are cousins, you
know, thanks to Wanda. Oh! she will be very unhappy in St.
Petersburg; she will not amuse herself, she never does. She is
incapable of a flirtation; she never touches a card. When she dances
it is only because she must, and then it is only a quadrille or a
contre-dance. She always reminds me of Marie Thérèse's "In our
position nothing is a trifle." You remember the Empress's letters to
Versailles?'
Sabran was very much angered, but he was afraid to express his
anger lest it should seem to make him absurd.
'Madame,' he said, with ill-repressed irritation, 'I know you speak
only in jest, but I must take the liberty to tell you——however
bourgeois it appear——that I do not allow a jest even from you upon
my wife. Anything she does is perfect in my sight, and if she be
imbued with the old traditions of gentle blood, too many ladies
desert them in these days for me not to be grateful to her for her
loyalty.'
She listened, with her bright black eyes fixed on him; then she
leaned a little more closely on his arm.
'Do you know that you said that very well? Most men are ridiculous
when they are in love with their wives, but it becomes you, Wanda is
perfect, we all know that; you are not alone in thinking so. Ask
Egon!'
The face of Sabran changed as he heard that name. As she saw the
change she thought: 'Can it be possible that he is jealous?'
Aloud she said with a little laugh: 'I almost wonder Egon did not run
you through the heart before you married. Now, of course, he is
reconciled to the inevitable; or, if not reconciled, he has to submit to
it as we all have to do. He grows very farouche; he lives between his
troopers and his castle of Taróc, like a barbaric lord of the Middle
Ages. Were you ever at Taróc? It is worth seeing——a huge fortress,
old as the days of Ottokar, in the very heart of the Karpathians. He
leads a wild, fierce life enough there. If he keep the memory of
Wanda with him it is as some men keep an idolatry for what is
dead.'
Sabran listened with a sombre irritation. 'Suppose we leave my
wife's name in peace,' he said coldly. 'The grosser cotillon is about to
begin; may I aspire to the honour?'
As he led her out, and the light fell on her red gold curls, on her
dazzling butterflies, her armour of diamonds, her snow-white skin, a
thousand memories of Cochonette came over him, though the scene
around him was the ball-room of the Hofburg, and the woman
whose great bouquet of rêve d'or roses touched his hand was a
great lady who had been the wife of Gela von Szalras, and the
daughter of the Prince Serriatine. He distrusted her, he despised her,
he disliked her so strongly that he was almost ashamed of his own
antagonism; and yet her contact, her grace of movement, the mere
scent of the bouquet of roses had a sort of painful and unwilling
intoxication for the moment for him.
He was glad when the long and gorgeous figures of the cotillon had
tired out even her steel-like nerves, and he was free to leave the
palace and go home to sleep. He looked at a miniature of his wife as
he undressed; the face of it, with its tenderness and its nobility,
seemed to him, after the face of this other woman, like the pure
high air of the Iselthal after the heated and unhealthy atmosphere of
a gambling-room.
The next day there was a review of troops in the Prater. His
presence was especially desired; he rode his favourite horse
Siegfried, which had been brought up from the Tauern for the
occasion. The weather was brilliant, the spectacle was grand; his
spirits rose, his natural gaiety of temper returned. He was addressed
repeatedly by the sovereigns present. Other men spoke of him,
some with admiration, some with envy, as one who would become a
power at the court and in the empire.
As he rode homeward, when the manœuvres were over, making his
way slowly through the merry crowds of the good-humoured
populace, through the streets thronged with glittering troops and
hung with banners, and odorous with flowers, he thought to himself
with a light heart: 'After all, I may do her some honour before I die.'
When he reached home and his horse was led away, a servant
approached him with a sealed letter lying on a gold salver. A courier,
who said that he had travelled with it without stopping from Taróc,
had brought it from the Most High the Prince Vàsàrhely.
Sabran's heart stood still as he took the letter and passed up the
staircase to his own apartments. Once there he ordered his servants
away, locked the doors, and, then only, broke the seal.
There were two lines written on the sheet inside. They said:
'I forbid you to serve my Sovereign. If you persist, I must relate to
him, under secrecy, what I know.'
They were fully signed——'Egon Vàsàrhely.' They had been sent by a
courier, to insure delivery and avoid the publicity of the telegraph.
They had been written as soon as the tidings of his appointment to
the Russian mission had become known at the mountain fortress of
Taróc.

CHAPTER XXIV.

As the carriage of the Countess Olga rolled home through the


Graben after the military spectacle, she stopped it suddenly, and
signed to an old man in the crowd who was waiting to cross the
road until a regiment of cuirassiers had rolled by. He was eyeing
them critically, as only an old soldier does look at troops.
'Is it you, Georg?' said Madame Olga. 'What brings you here?'
'I came from Taróc with a letter from the Prince, my master,'
answered the man, an old hussar who had carried Vàsàrhely in his
arms off the field of Königsgrätz, after dragging him from under a
heap of dead men and horses.
'A letter! To whom?' asked Olga, who always was curious and
persistent in investigation of all her brother-in-law's movements and
actions.
Vàsàrhely had not laid any injunction as to secrecy, only as to speed,
upon his faithful servant; so that Georg replied, unwitting of harm,
'To the Markgraf von Sabran, my Countess.'
'A letter that could not go by post—how strange! And from Egon to
Wanda's husband!' she thought, with her inquisitive eagerness
awakened. Aloud she bade the old trooper call at her palace for a
packet for Taróc, to make excuse for having stopped and questioned
him, and drove onward lost in thought.
'Perhaps it is a challenge late in the day!' she thought, with a laugh;
but she was astonished and perplexed that any communication
should take place between these men; she perplexed her mind in
vain in the effort to imagine what tie could connect them, what
mystery mutually affecting them could lie beneath the secret of
Vassia Kazán.
When, on the morrow, she heard at Court that the Emperor was
deeply incensed at the caprice and disrespect of the Count von
Idrac, as he was called at Court, who, at the eleventh hour, had
declined a mission already accepted by him, and of which the offer
had been in itself an unprecedented mark of honour and confidence,
her swift sagacity instantly associated the action, apparently so
excuseless and inexcusable, with the letter sent up from Taróc. It
was still as great a mystery to her as it had been before what the
contents of the letter could have been, but she had no doubt that in
some way or another it had brought about the resignation of the
appointment. It awakened a still more intense curiosity in her, but
she was too wise to whisper her suspicion to anyone. To her friends
at the Court she said, with laughter: 'A night or two ago I chanced to
tell Sabran that his wife would be wretched at St. Petersburg. That is
sure to have been enough for him. He is such a devoted husband.'
No one of course believed her, but they received the impression that
she knew the real cause of his resignation, though she could not be
induced to say it.
What did it matter to her? Nothing, indeed. But the sense of a secret
withheld from her was to Mdme. Olga like the slot of the fox to a
young hound. She might have a thousand secrets of her own if it
pleased her, but she could not endure anyone else to guard one.
Besides, in a vague, feverish, angry way, she was almost in love with
the man who was so faithful to his wife that he had looked away
from her as from some unclean thing when she had wished to dazzle
him. She had no perception that the secret could concern him
himself very nearly, but she thought it was probably one which he
and Egon Vàsàrhely, for reasons of their own, chose to share and
keep hidden. And if it were a secret that prevented Sabran from
going to the Court of Russia? Then, surely, it was one worth
knowing? And if she gained a knowledge of it, and his wife had
none?——what a superiority would be hers, what a weapon always
to hand!
She did not intend any especial cruelty or compass any especial end:
she was actuated by a vague desire to interrupt a current of
happiness that flowed on smoothly without her, to interfere where
she had no earthly title or reason to do so, merely because she was
disregarded by persons content with each other. It is not always
definite motives which have the most influence; the subtlest poisons
are those which enter the system we know not how, and penetrate it
ere we are aware. The only thing which had ever held her back from
any extremes of evil had been the mere habit of good-breeding and
an absolute egotism which had saved her from all strong passions.
Now something that was like passion had touched her under the
sting of Sabran's indifference, and with it she became tenacious,
malignant, and unsparing: adroit she had always been. Instinct is
seldom at fault when we are conscious of an enemy, and Sabran's
had not erred when it had warned him against the wife of Stefan
Brancka as the serpent who would bring woe and disaster to his
paradise.
In some three months' time she received a more explicit answer
from her cousin in St. Petersburg. Giving the precise dates, he told
her that Vassia Kazán was the name given to the son of Count Paul
Ivanovitch Zabaroff by a wayside amour with one of his own serfs at
a village near the border line of Astrachan. He narrated the early
history of the youth, and said that he had been amongst the
passengers on board a Havre ship, which had foundered with all
hands. So far the brief record of Vassia Kazán was clear and
complete. But it told her nothing. She was unreasonably enraged,
and looked at the little piece of burnt paper as though she would
wrench the secret out of it.
'There must be so much more to know,' she thought. 'What would a
mere drowned boy be to either of those men——a boy dead too all
these years before?'
She wrote insolently to her cousin, that the Third Section, with its
eyes of Argus and its limbs of Vishnoo, had always been but an
overgrown imbecile, and set her woman's wits to accomplish what
the Third Section had failed to do for her. So much she thought of it
that the name seemed forced into her very brain; she seemed to
hear every one saying——'Vassia Kazán.' It was a word to conjure
with, at least: she could at the least try the effect of its utterance
any day upon either of those who had made it the key of their
correspondence. Russia had written down Vassia Kazán as dead, and
the mystery which enveloped the name would not open to her. She
knew her country too well not to know that this bold statement
might cover some political secret, some story wholly unlike that
which was given her. Vassia Kazán might have lived and have
incurred the suspicions of the police, and be dwelling far away in the
death in life of Siberian mines, or deep sunk in some fortress, like a
stone at the bottom of a well. The reply not only did not beget her
belief in it, but gave her range for the widest and wildest conjectures
of imagination. 'It is some fault, some folly, some crime, who can
tell? And Vassia Kazán is the victim or the associate, or the confidant
of it. But what is it? And how does Egon know of it?'
She passed the summer in pleasures of all kinds, but the subject did
not lose its power over her, nor did she forget the face of Sabran as
he had turned it away from her in the ball-room of the Hofburg.
He himself had left the capital, after affirming to the minister that
private reasons, which he could not enter into, had induced him to
entreat the Imperial pardon for so sudden a change of resolve, and
to solicit permission to decline the high honour that had been
vouchsafed to him.
'What shall I say to Wanda?' he asked himself incessantly, as the
express train swung through the grand green country towards
Salzburg.
She was sitting on the lake terrace with the Princess, when a
telegram from her cousin Kunst was brought to her. Bela and Gela
were playing near with squadrons of painted cuirassiers, and the
great dogs were lying on the marble pavement at her feet. It was a
golden close to a sunless but fine day; the snow peaks were growing
rosy as the sun shone for an instant behind the Venediger range,
and the lake was calm and still and green, one little boat going
noiselessly across it from the Holy Isle to the further side.
'What a pity to leave it all!' she thought as she took the telegram.
The Minister's message was curt and angered:
'Your husband has resigned; he makes himself and me ridiculous.
Unable to guess his motive, I am troubled and embarrassed beyond
expression.'
The other, from Sabran, said simply: 'I am coming home. I give up
Russia.'
'Any bad news?' the Princess asked, seeing the seriousness of her
face. Her niece rose and gave her the papers.
'Is Réné mad!' she exclaimed as she read. His wife, who was startled
and dismayed at the affront to her cousin and to her sovereign, yet
had been unable to repress a movement of personal gladness,
hastened to say in his defence:
'Be sure he has some grave, good reason, dear mother. He knows
the world too well to commit a folly. Unexplained, it looks strange,
certainly; but he will be home to-night or in the early morning; then
we shall know; and be sure we shall find him right.'
'Right!' echoed the Princess, lifting the little girl who was her
namesake off her knee, a child white as a snowdrop, with golden
curls, who looked as if she had come out of a band of Correggio's
baby angels.
'He is always right,' said his wife, with a gesture towards Bela, who
had paused in his play to listen, with a leaden cuirassier of the guard
suspended in the air.
'You are an admirable wife, Wanda,' said the Princess, with extreme
displeasure on her delicate features. 'You defend your lord when
through him you are probably brouillée with your Sovereign for life.'
She added, her voice tremulous with astonishment and anger: 'It is
a caprice, an insolence, that no Sovereign and no minister could
pardon. I am most truly your husband's friend, but I can conceive no
possible excuse for such a change at the very last moment in a
matter of such vast importance.'
'Let us wait, dear mother,' said Wanda softly. 'It is not you who
would condemn Réné unheard?'
'But such a breach of etiquette! What explanation can ever annul it?'
'Perhaps none. I know it is a very grave offence that he has
committed, and yet I cannot help being happy,' said his wife with a
smile, as she lifted up the little Ottilie, and murmured over the
child's fair curls, 'Ah, my dear little dove! We are not going to Russia
after all. You little birds will not leave your nest!'
'Bela is not going to the snow palace?' said he, whose ears were
very quick, and to whom his attendants had told marvellous
narratives of an utterly imaginary Russia.
'No; are not you glad, my dear?'
He thought very gravely for a moment.
'Bela is not sure. Marc says Bela would have slaves in Russia, and
might beat them.'
'Bela would be beaten himself if he did, and by my own hand, said
his mother very gravely. 'Oh, child! where did you get your cruelty?'
'He is not cruel,' said the Princess. 'He is only masterful.'
'Alas! it is the same thing.'
She sent the children indoors, and remained after the sun-glow had
all faded, and Mdme. Ottilie had gone away to her own rooms, and
paced to and fro the length of the terrace, troubled by an anxiety
which she would have owned to no one. What could have happened
to make him so offend alike the State and the Court? She tormented
herself with wondering again and again whether she had used any
incautious expression in her letters which could have betrayed to
him the poignant regret the coming exile gave her. No! she was sure
she had not done so. She had only written twice, preferring
telegrams as quicker, and, to a man, less troublesome than letters.
She knew courts and cabinets too well not to know that the step her
husband had taken was one which would wholly ruin the favour he
enjoyed with the former, and wholly take away all chance of his
being ever called again to serve the latter. Personally she was
indifferent to that kind of ambition; but her attachment to the
Imperial house was too strong, and her loyalty to it too hereditary,
for her not to be alarmed at the idea of losing its good-will.
Disquieted and afraid of all kinds of formless unknown ills, she went
with a heavy heart into the Rittersaal to a dinner for which she could
find no appetite. The Princess also, so talkative and vivacious at
other times, was silent and pre-occupied. The evening passed
tediously. He did not come.
It was past midnight, and she had given up all hope of his arrival,
when she heard the returning trot of the horses, who had been sent
over to Matrey in the evening on the chance of his being there. She
was in her own chamber, having dismissed her women, and was
trying in vain to keep her thoughts to nightly prayer. At the sound of
the horses' feet without, she threw on a négligé of white satin and
lace, and went, out on to the staircase to meet him. As he came up
the broad stairs, with Donau and Neva gladly leaping on him, he
looked up and saw her against the background of oak and tapestry
and old armour, with the light of a great Persian lamp in metal that
swung above shed full upon her. She had never looked more lovely
to him than as she stood so, her eyes eagerly searching the dim
shadow for him, and the loose white folds embroidered in silk with
pale roses flowing downward from her throat to her feet. He drew
her within her chamber, and took her in his arms with a passionate
gesture.
'Let us forget everything,' he murmured, 'except that we have been
parted nearly a month!'

CHAPTER XXV.

In the morning, after breakfast in the little Saxe room, she said to
him with gentle firmness: 'Réné, you must tell me now—why have
you refused Russia?'
He had known that the question must come, and all the way on his
homeward journey he had been revolving in his mind the answer he
would give to it. He was very pale, but otherwise he betrayed no
agitation as he turned and looked at her.
'That is what I cannot tell you,' he replied.
She could not believe she heard aright.
'What do you mean?' she asked him. 'I have had a message from
Kunst; he is deeply angered. I understand that, after all was
arranged, you abruptly resigned the Russian mission. I ask your
reasons. It is a very grave step to have taken. I suppose your
motives must be very strong ones?'
'They are so,' said Sabran; and he continued in the forced and
measured tone of one who recites what he has taught himself to
say: 'It is quite natural that your cousin Kunst should be offended;
the Emperor also. You perhaps will be the same when I say to you
that I cannot tell you, as I cannot tell them, the grounds of my
withdrawal. Perhaps you, like them, will not forgive it.'
Her nostrils dilated and her breast heaved: she was startled,
mortified, amazed. 'You do not choose to tell me!' she said in
stupefaction.
'I cannot tell you.'
'She gazed at him with the first bitterness of wrath that he had ever
seen upon her face. She had been used to perfect submission of
others all her life. She had the blood in her of stern princes, who had
meted out rule and justice against which there had been no appeal.
She was accustomed even in him to deference, homage,
consideration, to be consulted always, deferred to often. His answer
for the moment seemed to her an unwarrantable insult.
Her influence, her relatives, her sovereign, had given him one of the
highest honours conceivable, and he did not choose to even say why
he was thankless for it! Passionate and withering words rose to her
lips, but she restrained their utterance. Not even in that moment
could she bring herself to speak what might seem to rebuke him
with the weight of all his debt to her. She remained silent, but he
understood all the intense indignation that held her speechless
there. He approached her more nearly, and spoke with emotion, but
with a certain sternness in his voice——
'I know very well that I must offend and even outrage you. But I
cannot tell you my motives. It is the first time that I have ever acted
independently of you or failed to consult your wishes. I only venture
to remind you that marriage does give to the man the right to do so,
though I have never availed myself of it. Nay, even now, I owe you
too much to be ingrate enough to take refuge in my authority as
your husband. I prefer to owe more, as I have owed so much, to
your tenderness. I prefer to ask of you, by your love for me, not to
press me for an answer that I am not in a position to make; to be
content with what I say—that I have relinquished the Russian
mission because I have no choice but to do so.'
He spoke firmly, because he spoke only the truth, although not all
the truth.
A great anger rose up in her, the first that she had ever been moved
to by him. All the pride of her temper and all her dignity were
outraged by this refusal to have confidence in her. It seemed
incredible to her. She still thought herself the prey of some dream, of
some hallucination. Her lips parted to speak, but again she withheld
the words she was about to utter. Her strong justice compelled her
to admit that he was but within his rights, and her sense of duty was
stronger than her sense of self-love.
She did not look at him, nor could she trust her voice. She turned
from him without a syllable, and left the room. She was afraid of the
violence of the anger that she felt.
'If it had been only to myself I would pardon it,' she thought; 'but an
insult to my people, to my country, to my sovereign!—an insult
without excuse, or explanation, or apology——'
She shut herself alone within her oratory and passed the most bitter
hour of her life. The imperious and violent temper of the Szalras was
dormant in her character, though she had chastened and tamed it,
and the natural sweetness and serenity of her disposition had been a
counterpoise to it so strong that the latter had become the only
thing visible in her. But all the wrath of her race was now aroused
and in arms against what she loved best on earth.
'If it had been anything else,' she thought; 'but a public act like this
—an ingratitude to the Crown itself! A caprice for all the world to
chatter of and blame!'
It would have been hard enough to bear, difficult enough to explain
away to others, if he had told her his reasons, however captious,
unwise, or selfish they might be; but to have the door of his soul
thus shut upon her, his thoughts thus closed to her, hurt her with
intolerable pain, and filled her with a deep and burning indignation.
She passed all the early morning hours alone in her little temple of
prayer, striving in vain against the bitterness of her heart; above her
the great ivory Crucifixion, the work of Angermayer, beneath which
so many generations of the women of the House of Szalras had knelt
in their hours of tribulation or bereavement.
When she left the oratory she had conquered herself. Though she
could not extinguish the human passions that smarted and throbbed
within her, she knew her duty well enough to know that it must lie in
submission and in silence.
She sought for him at once. She found him in the library: he was
playing to himself a long dreamy concerto of Schubert's, to soothe
the irritation of his own nerves and pass away a time of keen
suspense. He rose as she came into the room, and awaited her
approach with a timid anxiety in his eyes, which she was too
absorbed by her own emotions to observe. He had assumed a
boldness that he had not, and had used his power to dominate her
rather in desperation than in any sense of actual mastery. In his
heart it was he who feared her.
'You were quite right,' she said simply to him. 'Of course, you are
master of your own actions, and owe no account of them to me. We
will say no more about it. For myself, you know I am content enough
to escape exile to any embassy.'
He kissed her hand with an unfeigned reverence and humility.
'You are as merciful as you are great,' he murmured. 'If I be silent it
is my misfortune.' He paused abruptly.
A sudden thought came over her as he spoke.
'It is some State secret that he knows and cannot speak of, and that
has made him unwilling to go. Why did I never think of that before?'
An explanation that had its root in honour, a reticence that sprang
from conscience, were so welcome to her, and to her appeared so
natural, that they now consoled her at once, and healed the wounds
to her own pride.
'Of course, if it be so, he is right not to speak even to me,' she
mused, and her only desire was now to save him from the insistence
and the indignation of the Princess, and the examination which
these were sure to entail upon him when he should meet her at the
noon breakfast now at hand.
To that end she sought out her aunt in her own apartments, taking
with her the tiny Ottilie, who always disarmed all irritation in her
godmother by the mere presence of her little flower-like face.
'Dear mother,' she said softly, when the child had made her morning
obeisance, 'I am come to ask of you a great favour and kindness to
me. Réné returned last night. He has done what he thought right. I
do not even ask his reasons. He has acted from force majeure by
dictate of his own honour. Will you do as I mean to do? Will you
spare him any interrogation? I shall be so grateful to you, and so will
he.'
Mdme. Ottilie, opening her bonbonnière for her namesake, drew up
her fragile figure with a severity unusual to her.
'Do I hear you aright? You do not even know the reasons of the
insult M. de Sabran has passed upon the Crown and Cabinet, and
you do not even mean to ask them?'
'I do mean that; and what I do not ask I feel sure you will admit no
one else has any right to ask of him.'
'No one certainly except His Majesty.'
'I presume His Majesty has had all information due to him as our
Imperial master. All I entreat of you, dearest mother, is to do as I
have done; assume, as we are bound to assume, that Réné has
acted wisely and rightly, and not weary him with questions to which
it will be painful to him not to respond.'
'Questions! I never yet indulged in anything so vulgar as curiosity,
that you should imagine I shall be capable of subjecting your
husband to a cross-examination. If you be satisfied, I can have no
right to be more exacting than yourself. The occurrence is to me
lamentable, inexcusable, unintelligible; but if explanation be not
offered me you may rest assured I shall not intrude my request for
it.'
'Of that I am sure; but I am not contented only with that. I want you
to feel no dissatisfaction, no doubt, no anger against him. You may
be sure that he has acted from conviction, because he was most
desirous to go to Russia, as you saw when you urged him to accept
the mission.'
'I have said the utmost that I can say,' replied the Princess, with a
chill light in her blue eyes. 'This little child is no more likely to ask
questions than I am, after what you have stated. But you must not
regard my silence as any condonation of what must always appear
to me a step disrespectful to the Crown, contrary to all usages of
etiquette, and injurious to his own future and that of his children.
His scruples of conscience came too late.'
'I did not say they were exactly that. I believe he learned something
which made him consider that his honour required him to withdraw.'
'That may be,' said the Princess, frigidly. 'As I observed, it came
lamentably late. You will excuse me if I breakfast in my own rooms
this morning.'
Wanda left her, gave the child to a nurse who waited without, and
returned to the library. She had offended and pained Mdme. Ottilie,
but she had saved her husband from annoyance. She knew that
though the Princess was by no means as free from curiosity as she
declared herself, she was too high-bred and too proud to solicit a
confidence withheld from her.
Sabran was seated at the piano where she had left him, but his
forehead rested on the woodwork of it, and his whole attitude was
suggestive of sad and absorbed thought and abandonment to
regrets that were unavailing.
'It has cost him so much,' she reflected as she looked at him.
'Perhaps it has been a self-sacrifice, a heroism even; and I, from
mere wounded feeling, have been angered against him and almost
cruel!'
With the exaggeration in self-censure of all generous natures, she
was full of remorse at having added any pain to the disappointment
which had been his portion; a disappointment none the less
poignant, as she saw, because it had been voluntarily, as she
imagined, accepted.
As he heard her approach he started and rose, and the expression of
his face startled her for a moment; it was so full of pain, of
melancholy, almost (could she have believed it) of despair. What
could this matter be to affect him thus, since being of the State it
could be at its worst only some painful and compromising secret of
political life which could have no personal meaning for him? It was
surely impossible that mere disappointment——a disappointment
self-inflicted——could bring upon him such suffering? But she threw
these thoughts away. In her great loyalty she had told herself that
she must not even think of this thing, lest she should let it come
between them once again and tempt her from her duty and
obedience. Her trust in him was perfect.
The abandonment of a coveted distinction was in itself a bitter
disappointment, but it seemed to him as nothing beside the sense of
submission and obedience compelled from him to Vàsàrhely. He felt
as though an iron hand, invisible, weighed on his life, and forced it
into subjection. When he had almost grown secure that his enemy's
knowledge was a buried harmless thing, it had risen and barred his
way, speaking with an authority which it was not possible to disobey.
With all his errors he was a man of high courage, who had always
held his own with all men. How the old forgotten humiliation of his
earliest years revived, and enforced from him the servile timidity of
the Slav blood which he had abjured. He had never for an instant
conceived it possible to disregard the mandate he received; that an
apparently voluntary resignation was permitted to him was, his
conscience acknowledged, more mercy than he could have
expected. That Vàsàrhely would act thus had not occurred to him;
but before the act he could not do otherwise than admit its justice
and obey.
But the consciousness of that superior will compelling him, left in
him a chill tremor of constant fear, of perpetual self-abasement.
What was natural to him was the reckless daring which many
Russians, such as Skobeleff, have shown in a thousand ways of peril.
He was here forced only to crouch and to submit; it was more
galling, more cruel to him than utter exposure would have been. The
sense of coercion was always upon him like a dragging chain. It
produced on him a despondency, which not even the presence of his
wife or the elasticity of his own nature could dispel.
He had to play a part to her, and to do this was unfamiliar and
hateful to him. In all the years before he had concealed a fact from
her, but he had never been otherwise false. Though to his
knowledge there had been always between them the shadow of a
secret untold, there had never been any sense upon him of
obligation to measure his words, to feign sentiments he had not, to
hide behind a carefully constructed screen of untruth. Now, though
he had indeed not lied with his lips, he had to sustain a concealment
which was a thousand times more trying to him than that
concealment of his birth and station to which he had been so long
accustomed that he hardly realised it as any error. The very nobility
with which she had accepted his silence, and given it, unasked, a
worthy construction, smote him with a deeper sense of shame than
even that which galled him when he remembered the yoke laid on
him by the will of Egon Vàsàrhely.
He roused himself to meet her with composure.
She rested her hand caressingly on his.
'We will never speak of Russia any more. I should be sorry were the
Kaiser to think you capricious or disloyal, but you have too much
ability to have incurred this risk. Let it all be as though there had
never arisen any question of public life for you. I have explained to
Aunt Ottilie; she will not weary you with interrogation; she
understands that you have acted as your honour bade you. That is
enough for those who love you as do she and I.'
Every word she spoke entered his very soul with the cruellest irony,
the sharpest reproach. But of these he let her see nothing. Yet he
was none the less abjectly ashamed, less passionately self-
condemned, because he had to consume his pain in silence, and had
the self-control to answer, still with a smile, as he touched a chord or
two of music:
'When the Israelites were free they hankered after the flesh-pots of
Egypt. They deserved eternal exile, eternal bondage. So do I, for
having ever been ingrate enough to dream of leaving Hohenszalras
for the world of men!'
Then he turned wholly towards the Erard keyboard, and with
splendour and might there rolled forth under his touch the military
march of Rákóczi: he was glad of the majesty and passion of the
music which supplanted and silenced speech.
'That is very grand,' she said, when the last notes had died away.
'One seems to hear the Eljén! of the whole nation in it. But play me
something more tender, more pathetic——some lieder half sorrow
and half gladness, you know so many of all countries.'
He paused a moment; then his hands wandered lightly across the
notes, and called up the mournful folk-songs that he had heard so
long, so long, before; songs of the Russian peasants, of the maidens
borne off by the Tartar in war, of the blue-eyed children carried away
to be slaves, of the homeless villagers beholding their straw-roofed
huts licked up by the hungry hurrying flame lit by the Kossack or the
Kurd; songs of a people without joy, that he had heard in his childish
days, when the great rafts had drifted slowly down the Volga water,
and across the plains the lines of chained prisoners had crept as
slowly through the dust; or songs that he had sung to himself, not
knowing why, where the winter was white on all the land, and 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!

ebookultra.com

You might also like