AI algorithms data structures and idioms in Prolog Lisp and Java 6th Edition George F. Luger 2024 scribd download
AI algorithms data structures and idioms in Prolog Lisp and Java 6th Edition George F. Luger 2024 scribd download
https://ebookultra.com
https://ebookultra.com/download/ai-algorithms-
data-structures-and-idioms-in-prolog-lisp-and-
java-6th-edition-george-f-luger/
https://ebookultra.com/download/data-structures-and-algorithms-in-
java-6th-edition-michael-t-goodrich/
ebookultra.com
https://ebookultra.com/download/artificial-intelligence-structures-
and-strategies-for-complex-problem-solving-6th-edition-george-f-luger/
ebookultra.com
https://ebookultra.com/download/data-structures-and-algorithms-in-
java-4th-edition-michael-t-goodrich/
ebookultra.com
https://ebookultra.com/download/learning-f-functional-data-structures-
and-algorithms-1st-edition-masood/
ebookultra.com
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/
ebookultra.com
https://ebookultra.com/download/java-collections-an-introduction-to-
abstract-data-types-data-structures-and-algorithms-1st-edition-david-
a-watt/
ebookultra.com
https://ebookultra.com/download/growing-algorithms-and-data-
structures-4th-edition-david-scuse/
ebookultra.com
https://ebookultra.com/download/data-structures-algorithms-in-go-1st-
edition-hemant-jain/
ebookultra.com
https://ebookultra.com/download/learning-javascript-data-structures-
and-algorithms-2nd-edition-loiane-groner/
ebookultra.com
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
George F. Luger
William A. Stubblefield
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
Exercises 266
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 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
Bibliography 439
Index 443
- 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
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
GL
BS
July 2008
Albuquerque
all good things - trout as well as eternal salvation - come by grace and grace comes by art and art does not
come easy…
Chapter This chapter introduces the ideas that we use to organize our thinking about
Objectives languages and how they shape the design and implementation of programs.
These are the ideas of language, idiom, and design pattern.
1.1 Introduction
Idioms and As with any craft, programming contains an undeniable element of
Patterns
experience. We achieve mastery through long practice in solving the
problems that inevitably arise in trying to apply technology to actual
problem situations. In writing a book that examines the implementation of
major AI algorithms in a trio of languages, we hope to support the reader’s
own experience, much as a book of musical etudes helps a young musician
with their own exploration and development.
As important as computational theory, tools, and experience are to a
programmer’s growth, there is another kind of knowledge that they only
suggest. This knowledge comes in the form of pattern languages and
idioms, and it forms a major focus of this book. The idea of pattern
languages originated in architecture (Alexander et al. 1977) as a way of
formalizing the knowledge an architect brings to the design of buildings
and cities that will both support and enhance the lives of their residents. In
recent years, the idea of pattern languages has swept the literature on
software design (Gamma, et al. 1995; Coplein & Schmidt 1995; Evans
2003), as a way of capturing a master’s knowledge of good, robust program
structure.
A design pattern describes a typical design problem, and outlines an
approach to its solution. A pattern language consists of a collection of
related design patterns. In the book that first proposed the use of pattern
languages in architecture, Christopher Alexander et al. (1977, page x) state
that a pattern
describes a problem which occurs over and over again in our environment, and
then describes the core of the solution to that problem, in such a way that you
can use this solution a million times over, without ever doing it the same way
twice.
Design patterns capture and communicate a form of knowledge that is
essential to creating computer programs that users will embrace, and that
The only way to rectify our reasonings is to make them as tangible as those of the mathematicians, so that
we can find our error at a glance, and when there are disputes among persons we can simply say, “Let us
calculate… to see who is right.”
—Leibniz, The Art of Discovery
17
19
These examples show how the predicate calculus connectives are expressed
in Prolog. The predicate names (likes), the number or order of parameters,
and even whether a given predicate always has the same number of
parameters are determined by the design requirements (the implicit
“semantics”) of the problem.
The form Prolog expressions take, as in the examples above, is a restricted
form of the full predicate calculus called the “Horn Clause calculus.” There
are many reasons supporting this restricted form, most important is the
power and computational efficiency of a resolution refutation system. For details
see Luger (2009, Chapter 14).
A Simple A Prolog program is a set of specifications in the first-order predicate
Prolog
Program
calculus describing the objects and relations in a problem domain. The set
of specifications is referred to as the database for that problem. The Prolog
interpreter responds to questions about this set of specifications. Queries to
the database are patterns in the same logical syntax as the database entries.
The Prolog interpreter uses pattern-directed search to find whether these
queries logically follow from the contents of the database.
The interpreter processes queries, searching the database in left to right
depth-first order to find out whether the query is a logical consequence of
the database of specifications. Prolog is primarily an interpreted language.
Some versions of Prolog run in interpretive mode only, while others allow
compilation of part or all of the set of specifications for faster execution.
Prolog is an interactive language; the user enters queries in response to the
Prolog prompt, “?-“.
Let us describe a “world” consisting of George’s, Kate’s, and Susie’s likes
and dislikes. The database might contain the following set of predicates:
likes(george, kate).
likes(george, susie).
likes(george, wine).
likes(susie, wine).
likes(kate, gin).
likes(kate, susie).
This set of specifications has the obvious interpretation, or mapping, into
the world of George and his friends. That world is a model for the database
(Luger 2009, Section 2.3). The interpreter may then be asked questions:
?- likes(george, kate).
Yes
?- likes(kate, susie).
Yes
?- likes(george, X).
X = kate
;
X = Susie
;
X = wine
;
no
?- likes(george, beer).
no
Note first that in the request likes(george, X), successive user
prompts (;) cause the interpreter to return all the terms in the database
specification that may be substituted for the X in the query. They are
returned in the order in which they are found in the database: kate before
susie before wine. Although it goes against the philosophy of
nonprocedural specifications, a determined order of evaluation is a
property of most interpreters implemented on sequential machines.
To summarize: further responses to queries are produced when the user
prompts with the ; (or). This forces the rejection of the current solution
and a backtrack on the set of Prolog specifications for answers. Continued
prompts force Prolog to find all possible solutions to the query. When no
further solutions exist, the interpreter responds no.
This example also illustrates the closed world assumption or negation as failure.
Prolog assumes that “anything is false whose opposite is not provably
true.” For the query likes(george, beer), the interpreter looks for
the predicate likes(george, beer) or some rule that could
establish likes(george, beer). Failing this, the request is false.
Prolog assumes that all knowledge of the world is present in the database.
The closed world assumption introduces a number of practical and
philosophical difficulties in the language. For example, failure to include a
fact in the database often means that its truth is unknown; the closed world
assumption treats it as false. If a predicate were omitted or there were a
misspelling, such as likes(george, beeer), the response remains
no. Negation-as-failure issue is an important topic in AI research. Though
negation-as-failure is a simple way to deal with the problem of unspecified
knowledge, more sophisticated approaches, such as multi-valued logics
(true, false, unknown) and nonmonotonic reasoning (see Luger
2009, Section 9.1), provide a richer interpretive context.
The Prolog expressions just seen are examples of fact specifications. Prolog
also supports rule predicates to describe relationships between facts. We use
the logical implication :- . For rules, only one predicate is permitted on
the left-hand side of the if symbol :-, and this predicate must be a positive
literal, which means it cannot have not in front of it. All predicate calculus
expressions that contain logical implication must be reduced to this form,
referred to as Horn clause logic. In Horn clause form, the left-hand side
(conclusion) of an implication must be a single positive literal. The Horn
clause calculus is equivalent to the full first-order predicate calculus for proofs
by refutation (Luger 2009, Chapter 14).
Suppose we add to the specifications of the previous database a rule for
determining whether two people are friends. This may be defined:
friends(X, Y) :- likes(X, Z), likes(Y, Z).
This expression might be interpreted as “X and Y are friends if there exists
a Z such that X likes Z and Y likes Z.” Two issues are important here. First,
because neither the predicate calculus nor Prolog has global variables, the
scopes (extent of definition) of X, Y, and Z are limited to the friends
rule. Second, values bound to, or unified with, X, Y, and Z are consistent
across the entire expression. The treatment of the friends rule by the
Prolog interpreter is seen in the following example.
With the friends rule added to the set of specifications of the preceding
example, we can query the interpreter:
?- friends(george, susie).
yes
To solve this query, Prolog searches the database using the backtrack
algorithm. Briefly, backtrack examines each predicate specification in the
order that it was placed in the Prolog. If the variable bindings of the
specification satisfy the query it accepts them. If they don’t, the interpreter
goes on to the next specification. If the interpreter runs into a dead end,
i.e., no variable substitution satisfies it, then it backs up looking for other
variable bindings for the predicates it has already satisfied. For example,
using the predicate specifications of our current example, the query
friends(george, susie) is unified with the conclusion of the rule
friends(X, Y) :- likes(X, Z), likes(Y, Z), with X as
george and Y as susie. The interpreter looks for a Z such that
likes(george, Z) is true and uses the first fact, with Z as kate.
The interpreter then tries to determine whether likes(susie,
kate) is true. When it is found to be false, using the closed world
assumption, this value for Z (kate) is rejected. The interpreter backtracks
to find a second value for Z. likes(george, Z) then matches the
second fact, with Z bound to susie. The interpreter then tries to match
likes(susie, susie). When this also fails, the interpreter goes
back to the database for yet another value for Z. This time wine is found
in the third predicate, and the interpreter goes on to show that
likes(susie, wine) is true. In this case wine is the binding that
ties george and susie.
It is important to state the relationship between universal and existential
quantification in the predicate calculus and the treatment of variables in a
Prolog program. When a variable is placed in the specifications of a Prolog
database, it is universally quantified. For example, likes(susie, Y)
means, according to the semantics of the previous examples, “Susie likes
everyone.” In the course of interpreting a query, any term, or list, or
predicate from the domain of Y, may be bound to Y. Similarly, in the rule
friends(X, Y) :- likes(X, Z), likes(Y, Z), any X, Y,
and Z that meets the specifications of the expression are used.
To represent an existentially quantified variable in Prolog, we may take two
approaches. First, if the existential value of a variable is known, that value
may be entered directly into the database. Thus, likes(george,
wine) is an instance of likes(george, Z).
Second, to find an instance of a variable that makes an expression true, we
query the interpreter. For example, to find whether a Z exists such that
likes(george, Z) is true, we put this query to the interpreter. It will
find whether a value of Z exists under which the expression is true. Some
Prolog interpreters find all existentially quantified values; C-Prolog requires
repeated user prompts (;), as shown previously, to get all values.
2.3 Creating, Changing, and Tracing a Prolog Computation
In building a Prolog program the database of specifications is created first.
In an interactive environment the predicate assert can be used to add
new predicates to the set of specifications. Thus:
?- assert(likes(david, sarah)).
adds this predicate to the computing specifications. Now, with the query:
?- likes(david, X).
X = sarah.
is returned. assert allows further control in adding new specifications to
the database: asserta(P) asserts the predicate P at the beginning of all
the predicates P, and assertz(P) adds P at the end of all the predicates
named P. This is important for search priorities and building heuristics. To
remove a predicate P from the database retract(P) is used. (It should
be noted that in many Prologs assert can be unpredictable in that the
exact entry time of the new predicate into the environment can vary
depending on what other things are going on, affecting both the indexing
of asserted clauses as well as backtracking.)
It soon becomes tedious to create a set of specifications using the
predicates assert and retract. Instead, the good programmer takes
her favorite editor and creates a file containing all the Prolog program’s
specifications. Once this file is created, call it myfile, and Prolog is
called, then the file is placed in the database by the Prolog command
consult. Thus:
?- consult(myfile).
yes
integrates the predicates in myfile into the database. A short form of the
consult predicate, and better for adding multiple files to the database,
uses the list notation, to be seen shortly:
?- [myfile].
yes
If there are any syntax errors in your Prolog code the consult operator
will describe them at the time it is called.
The predicates read and write are important for user/system
communication. read(X) takes the next term from the current input
stream and binds it to X. Input expressions are terminated with a “.”
write(X) puts X in the output stream. If X is unbound then an integer
preceded by an underline is printed (_69). This integer represents the
internal bookkeeping on variables necessary in a theorem-proving
environment (see Luger 2009, Chapter 14).
The Prolog predicates see and tell are used to read information from
and place information into files. see(X) opens the file X and defines the
current input stream as originating in X. If X is not bound to an available
file see(X) fails. Similarly, tell(X) opens a file for the output stream.
If no file X exists, tell(X) creates a file named by the bound value of X.
seen(X) and told(X) close the respective files.
A number of Prolog predicates are important in helping keep track of the
state of the Prolog database as well as the state of computing about the
database; the most important of these are listing, trace, and spy. If
we use listing(predicate_name) where predicate_name is
the name of a predicate, such as friends (above), all the clauses with
that predicate name in the database are returned by the interpreter. Note
that the number of arguments of the predicate is not indicated; in fact, all
uses of the predicate, regardless of the number of arguments, are returned.
trace allows the user to monitor the progress of the Prolog interpreter.
This monitoring is accomplished by printing to the output file every goal
that Prolog attempts, which is often more information than the user wants
to have. The tracing facilities in Prolog are often rather cryptic and take
some study and experience to understand. The information available in a
trace of a Prolog program usually includes the following:
The depth level of recursive calls (marked left to right on line).
When a goal is tried for the first time (sometimes call is used).
When a goal is successfully satisfied (with an exit).
When a goal has further matches possible (a retry).
When a goal fails because all attempts to satisfy it have failed
The goal notrace stops the exhaustive tracing.
When a more selective trace is required the goal spy is useful. This
predicate takes a predicate name as argument but sometimes is defined as a
prefix operator where the predicate to be monitored is listed after the
operator. Thus, spy member causes the interpreter to print to output all
uses of the predicate member. spy can also take a list of predicates
followed by their arities: spy[member/2, append/3] monitors
member with two arguments and append with three. nospy removes
these spy points.
2.4 Lists and Recursion in Prolog
The previous subsections presented Prolog syntax with several simple
examples. These examples introduced Prolog as an engine for computing
with predicate calculus expressions (in Horn clause form). This is
consistent with all the principles of predicate calculus inference presented
in Luger (2009, Chapter 2). Prolog uses unification for pattern matching
and returns the bindings that make an expression true. These values are
unified with the variables in a particular expression and are not bound in
the global environment.
Recursion is the primary control mechanism for Prolog programming. We
will demonstrate this with several examples. But first we consider some
simple list-processing examples. The list is a data structure consisting of
ordered sets of elements (or, indeed, lists). Recursion is the natural way to
process the list structure. Unification and recursion come together in list
;
no
To define member recursively, we first test if X is the first item in the list:
member(X, [X | T]).
This tests whether X and the first element of the list are identical. Not that
this pattern will match no matter what X is bound to: an atom, a list,
whatever! If the two are not identical, then it is natural to check whether X
is an element of the rest (T) of the list. This is defined by:
member(X, [Y | T]) :- member(X, T).
The two lines of Prolog for checking list membership are then:
member(X, [X | T]).
member(X, [Y | T]) :- member(X, T).
This example illustrates the importance of Prolog’s built-in order of search
with the terminating condition placed before the recursive call, that is, to be
tested before the algorithm recurs. If the order of the predicates is reversed,
the terminating condition may never be checked. We now trace
member(c,[a,b,c]), with numbering:
1: member(X, [X | T]).
2: member(X, [Y | T]) :- member(X, T).
?- member(c, [a, b, c]).
call 1. fail, since c <> a
call 2. X = c, Y = a, T = [b, c],
member(c, | [b,c])?
call 1. fail, since c <> b
call 2. X = c, Y = b, T = [c],
member(c, | [c])?
call 1. success, c = c
yes (to second call 2.)
yes (to first call 2.)
yes
Good Prolog style suggests the use of anonymous variables. These serve as an
indication to the programmer and interpreter that certain variables are used
solely for pattern-matching purposes, with the variable binding itself not
part of the computation process. Thus, when we test whether the element
X is the same as the first item in the list we usually say: member(X,
[X|_]). The use of the _ indicates that even though the tail of the list
plays a crucial part in the unification of the query, the content of the tail of
the list is unimportant. In the member check the anonymous variable
should be used in the recursive statement as well, where the value of the
head of the list is unimportant:
member(X, [X | _]).
member(X, [_ | T]) :- member(X, T).
Writing out a list one element to a line is a nice exercise for understanding
both lists and recursive control. Suppose we wish to write out the list
[a,b,c,d]. We could define the recursive command:
writelist([ ]).
writelist([H | T]) :- write(H), nl, writelist(T).
EL COMERCIANTE
Jueves 1.º
I padre quiere que cada día de fiesta haga venir a casa
a uno de mis compañeros, o que vaya a buscarlo para
hacerme poco a poco amigo de todos. El domingo fuí a
pasear con Votino: aquél tan bien vestido, que se está
siempre alisando y que tiene tanta envidia de Deroso.
Hoy ha venido a casa Garofi: aquél alto y delgado, con la nariz de
pico de loro y los ojos pequeños y vivos, que parecen sondearlo
todo. Es hijo de un droguero, y tipo muy original. Está siempre
contando los cuartos que tiene en el bolsillo; cuenta muy de prisa
con los dedos, y verifica cualquier multiplicación sin necesidad de
tabla pitagórica. Hace sus economías, y tiene ya una libreta de la
Caja de Ahorros escolar. Es desconfiado, no gasta nunca un cuarto, y
si se le cae un céntimo debajo del banco, es capaz de pasarse la
semana buscándolo. “Es como la urraca”, dice Deroso. Todo lo que
encuentra, plumas gastadas, sellos usados, alfileres, cerillas, todo lo
recoge. Hace ya más de dos años que colecciona sellos, y tiene ya
centenares de todos los países, en su grande álbum, que venderá
después al librero cuando esté completo. Entretanto, el librero le da
muchos cuadernos gratis, porque le lleva los niños a la tienda. En la
escuela está siempre traficando; todos los días vende, hace loterías
y subastas; después se arrepiente y quiere sus mercancías; compra
por dos y vende por cuatro; juega a las aleluyas y jamás pierde;
vende los periódicos atrasados al estanquero, y tiene un cuaderno
donde anota todos sus negocios, lleno todo él de sumas y de restas.
En la escuela sólo estudia Aritmética; y si ambiciona premios, no es
más que por tener entrada gratis en el teatro Guiñol. A mí me gusta
y me entretiene. Hemos jugado a hacer una tienda con los pesos y
las balanzas: él sabe el precio exacto de todas las cosas, conoce las
pesas y hace muy pronto y bien cartuchos y paquetes como los
tenderos. Dice que apenas salga de la escuela, emprenderá un
negocio, un comercio nuevo, inventado por él. Ha estado muy
contento porque le he dado sellos extranjeros, y me ha dicho al
punto en cuánto se vende cada uno para las colecciones. Mi padre,
haciendo como que leía el periódico, le estaba oyendo y se divertía.
Siempre lleva los bolsillos llenos de sus pequeñas mercancías, que
cubre con un largo delantal negro, y parece que está continuamente
pensativo y muy ocupado, como los comerciantes. Pero lo que le
gusta más que todo es su colección de sellos: éste es su tesoro, y
habla siempre de él como si debiese sacar de aquí una fortuna. Los
compañeros lo creen avaro y usurero. Yo no pienso así. Le quiero
bien; me enseña muchas cosas, y me parece un hombre. Coreta, el
hijo del vendedor de leña, dice que no daría Garofi sus sellos ni para
salvar la vida de su madre. Mi padre no lo cree. “Espera aún para
juzgarle, me ha dicho; tiene, en efecto, esa pasión; pero su corazón
es bueno”.
VANIDAD
Lunes 5.—Ayer fuí a pasear por la alameda de Rívoli con Votino y su
padre. Al pasar por la calle Dora Grosa vimos a Estardo, el que se
incomoda con los revoltosos, parado muy tieso delante del
escaparate de un librero, con los ojos fijos en un mapa: y sabe Dios
desde cuándo estaría allí, porque él estudia hasta en la calle; ni
siquiera nos saludó el muy grosero. Votino iba muy bien vestido,
quizá demasiado; llevaba botas de tafilete con pespuntes
encarnados, un traje con adornos y vivos de seda, sombrero blanco
de castor y reloj. Pero su vanidad debía parar en mal esta vez.
Después de haber andado buen trecho por la calle, dejándonos muy
atrás a su padre, que marchaba despacio, nos paramos en un
asiento de piedra junto a un muchacho modestamente vestido que
parecía cansado y estaba pensativo, con la cabeza baja. Un hombre,
que debía ser su padre, paseaba bajo los árboles leyendo un
periódico. Nos sentamos. Votino se puso entre el otro niño y yo. De
pronto se acordó de que estaba bien vestido, y quiso hacerse
admirar y envidiar de nuestro vecino. Levantó un pie y me dijo:
“¿Has visto mis botas nuevas?”. Lo decía para que el otro las mirara,
pero éste no se fijó. Entonces bajó el pie y me enseñó las borlas de
seda, mirando de reojo al muchacho, añadiendo que aquellas borlas
de seda no le gustaban y que las quería cambiar por botones de
plata. Pero el chico no miró tampoco.
Votino, entonces, se puso a jugar, dándole vueltas sobre el índice,
con su precioso sombrero de castor blanco: pero el niño parecía que
lo hacía de propósito; no se dignó dirigir siquiera una mirada al
sombrero.
Pero el ciego, que lo había comprendido todo, dijo con una sonrisa
breve y melancólica: “¡Oh, no importa nada!”.
LA PRIMERA NEVADA
Sábado 10.—¡Adiós, paseos a Rívoli! Llegó la hermosa amiga de los
niños. ¡Ya están aquí las primeras nieves! Ayer tarde, a última hora,
cayeron copos finos y abiertos, como flores de jazmín. Era un gusto
esta mañana, en la escuela, verla caer contra los cristales y
amontonarse sobre los balcones; también el maestro miraba y se
frotaba las manos; y todos estaban contentos pensando hacer bolas,
en el hielo que vendría después, y en el hogar de la casa.
Únicamente Estardo no se distraía, completamente absorto en la
lección y con los puños apoyados en las sienes. ¡Qué hermosura,
cuánta alegría hubo a la salida! Todos salíamos a la desbandada por
las calles, gritando y charlando, cogiendo pelotones de nieve y
zambulléndonos dentro como perrillos en el agua. Los padres que
esperaban fuera ya tenían los paraguas blancos; los guardias
municipales también blancos sus quepís; nuestras carteras se
pusieron blancas en seguida. Todos parecían en su delirio fuera de
sí: hasta Precusa, el hijo del forjador, aquel pálido que nunca se ríe,
y hasta Roberto, el que salvó al niño del ómnibus, el pobrecillo
saltaba con sus muletas. El calabrés, que no había tocado nunca la
nieve, hizo una pelota y se puso a comérsela como un melocotón.
Crosi, el hijo de la verdulera, se llenó de nieve la cartera, y el
albañilito nos hizo desternillar de risa cuando mi padre le invitó a
venir mañana a casa; tenía la boca llena de nieve, y no atreviéndose
a escupirla ni a tragársela, se quedó atónito mirándonos, sin
responder. También las maestras salían de la escuela corriendo y
riendo: hasta mi maestra de primera enseñanza superior, ¡pobrecilla!
corría atravesando la nieve, preservándose la cara con un velo verde
y tosiendo. Mientras tanto, centenares de muchachas de la escuela
inmediata pasaban chillando y pisoteando sobre aquella blanca
alfombra, y los maestros, los bedeles y los guardias gritaban: “¡A
casa, a casa!”, tragando copos de nieve y quitándosela de los bigotes
y de la barba. Pero también ellos se reían de aquella turba de
muchachos que festejaban el invierno...
“...Festejáis el invierno...; pero hay niños sin pan, sin zapatos, sin
lumbre. Hay millares que bajan a las ciudades después de largo
camino, llevando en sus manos ensangrentadas por los sabañones,
un pedazo de leña para calentar la escuela. Hay centenares de
escuelas casi sepultadas entre la nieve, desnudas y obscuras como
cavernas, donde los chicos se ahogan por el humo, dan diente con
diente por el frío, mirando con horror los blancos copos que caen sin
cesar, que se amontonan sin descanso sobre sus lejanas cabañas,
amenazadas por el peso de los témpanos de hielo. Vosotros, niños,
festejáis el invierno. ¡Pensad en los miles de criaturas a quienes el
invierno trae la miseria y la muerte!—Tu padre”.
EL ALBAÑILITO
Domingo 11.—El “albañilito” ha venido hoy de cazadora, vestido con
la ropa de su padre, blanca todavía por la cal y el yeso. Mi padre
deseaba que viniese, aún más que yo. ¡Cómo le gusta! Apenas
entró, se quitó su viejísimo sombrero, que estaba todo cubierto de
nieve, y se lo metió en el bolsillo; después vino hacia mí con aquel
andar descuidado de cansado trabajador, volviendo aquí y allá su
cabeza, redonda como una manzana, y con su nariz roma; y cuando
fué al comedor, dirigiendo una ojeada a los muebles, fijó sus ojos en
un cuadrito que representaba a Rigoleto, un bufón jorobado, y puso
la cara de “hocico de conejo”. Es imposible dejar de reír al vérselo
hacer. Nos pusimos a jugar con palitos; tiene una habilidad
extraordinaria para hacer torres y puentes, que parece se están de
pie por milagro, y trabaja en ello muy serio, con la paciencia de un
hombre. Entre una y otra torre me habla de su familia; viven en una
boardilla; su padre va a la escuela de adultos, de noche, a aprender
a leer; su madre no es de aquí. Parece que le quieren mucho,
porque aunque él viste pobremente, va bien resguardado del frío,
con la ropa muy remendada y el lazo de la corbata bien hecho y
anudado por su misma madre. Su padre, me dice, es un hombretón,
un gigante, que apenas cabe por la puerta; es bueno, y llama
siempre a su hijo “hocico de liebre”; el hijo, en cambio, es pequeñín.
A las cuatro merendamos juntos, pan y pasas, sentados en el sofá, y
cuando nos levantamos, no sé por qué mi padre no quiso que
limpiara el espaldar que el albañilito había manchado de blanco con
su chaqueta; me detuvo la mano y lo limpió después él sin que lo
viéramos. Jugando, al albañilito se le cayó un botón de la cazadora,
y mi madre se lo cosió; él se puso encarnado, y la veía coser muy
admirado y confuso, no atreviéndose ni a respirar. Después le
enseñé el álbum de caricaturas, y él, sin darse cuenta, imitaba los
gestos de aquellas caras, tan bien, que hasta mi padre se reía.
Estaba tan contento cuando se fué que se olvidó de ponerse el
andrajoso sombrero, y al llegar a la puerta de la escalera, para
manifestarme su gratitud, me hacía otra vez la gracia de poner el
“hocico de liebre”. Se llama Antonio Rabusco, y tiene ocho años y
ocho meses.
“¿Sabes, hijo mío, por qué no quise que limpiaras el sofá? Porque
limpiarle mientras tu compañero lo veía, era casi hacerle una
reconvención por haberlo ensuciado. Y esto no estaba bien: en
primer lugar, porque no lo había hecho de intento, y en segundo,
porque le había manchado con ropa de su padre, que se la había
enyesado trabajando; y lo que se mancha trabajando no ensucia: es
polvo, cal, barniz, todo lo que quieras, pero no es suciedad. El
trabajo no ensucia. No digas nunca de un obrero que sale de su
trabajo: ‘Va sucio’. Debes decir: ‘Tiene en sus ropas las señales, las
huellas del trabajo’. Recuérdalo. Quiere mucho al albañilito: primero,
porque es compañero tuyo, y además, porque es hijo de un obrero.
—Tu padre”.
LAS MAESTRAS
Sábado 17.—Garofi estaba hoy muy atemorizado, esperando un gran
regaño del maestro; pero el profesor no ha ido, y como faltaba
también el suplente, ha venido a dar la clase la señora Cromi, la más
vieja de las maestras, que tiene dos hijas mayores y ha enseñado a
leer y escribir a muchas señoras que ahora van a llevar sus niños a
la escuela Bareti. Hoy estaba triste, porque tenía un hijo enfermo.
Apenas la vieron, empezaron a hacer gran ruido. Pero ella, con voz
pausada y serena, dijo: “Respetad mis canas; yo casi no soy ya una
maestra, sino una madre”; y entonces ninguno se atrevió a hablar
más, ni aun aquel cara de bronce de Franti, que se contentó con
hacerle burla sin que lo viera. A la clase de la señora Cromi
mandaron a la señora Delcato, maestra de mi hermano, y al puesto
de ésta a la que llaman “la monjita”, porque va siempre vestida de
obscuro, con un delantal negro; su cara es pequeña y blanca, sus
cabellos siempre peinados, los ojos muy claros y la voz tan gangosa,
que parece está murmurando oraciones. “Y es cosa que no se
comprende—dice mi madre—: tan suave y tan tímida, con aquel
hilito de voz siempre igual, que apenas suena, sin gritar y sin
incomodarse nunca, y, sin embargo, los niños están tan quietos, que
no se les oye, y hasta los más atrevidos inclinan la cabeza en cuanto
les amenaza con el dedo; parece una iglesia su escuela, y por eso
también la llaman la monjita”. Pero hay otra que me gusta mucho: la
maestra de primera enseñanza elemental, número 3; una joven con
la cara sonrosada, que tiene dos lunares muy graciosos en las
mejillas, y que lleva una pluma encarnada en el sombrero y una
crucecita amarilla colgada del cuello. Siempre está alegre, y alegre
también tiene su clase; sonríe, y cuando grita con aquella voz
argentina, parece que canta; pega con la regla en la mesa y da
palmadas para imponer silencio; después, cuando salen, corre como
una niña detrás de unos y de otros, para ponerlos en fila; y a éste le
tira del babero, al otro le abrocha el abrigo para que no se resfríe;
los sigue hasta la calle para que no alboroten; suplica a los padres
que no les castiguen en casa; lleva pastillas a los que tienen tos;
presta su manguito a los que tienen frío, y está continuamente
atormentada por los más pequeños, que le hacen caricias y le piden
besos, tirándole del velo y del vestido; pero ella se deja acariciar y
los besa a todos riendo, y todos los días vuelve a casa despeinada y
ronca, jadeante y tan contenta, con sus graciosos lunares y su
pluma colorada. Es también maestra de dibujo de las niñas, y
sostiene con su trabajo a su madre y a su hermano.
El hijo sabía que con su padre era inútil insistir en aquellas cosas, y
no insistió. Pero he aquí lo que hizo. Sabía que a las doce en punto
dejaba su padre de escribir y salía del despacho para la alcoba.
Alguna vez lo había oído: en cuanto el reloj daba las doce, sentía
inmediatamente el rumor de la silla que se movía y el lento paso de
su padre. Una noche esperó a que estuviese ya en la cama, se vistió
sin hacer ruido, anduvo a tientas por el cuarto, encendió el quinqué
de petróleo, se sentó a la mesa del despacho, donde había un
montón de fajas blancas y la indicación de las señas de los
subscriptores, y empezó a escribir, imitando todo lo que pudo la letra
de su padre. Y escribía contento, con gusto, aunque con miedo; las
fajas escritas aumentaban, y de vez en cuando dejaba la pluma para
frotarse las manos; después continuaba con más alegría, atento el
oído y sonriente. Escribió ciento sesenta: ¡cerca de una peseta!
Entonces paró; dejó la pluma donde estaba, apagó la luz y se volvió
a la cama de puntillas.
Aquel día, a las doce, el padre se sentó a la mesa de buen humor.
No había advertido nada. Hacía aquel trabajo mecánicamente,
contando las horas, pensando en otra cosa y no contando las fajas
escritas hasta el día siguiente. Sentados a la mesa con buen humor,
y poniendo la mano en el hombro de su hijo: “¡Eh, Julio—le dijo—
mira qué buen trabajador es tu padre! En dos horas ha trabajado
anoche un tercio más de lo que acostumbra. La mano aún está ágil,
y los ojos cumplen todavía con su deber”. Julio, contento, mudo,
decía entre sí: “¡Pobre padre! Además de la ganancia, le he
proporcionado también esta satisfacción: la de creerse rejuvenecido:
¡Ánimo, pues!”.
Sin embargo, aquella noche se levantó todavía más bien por fuerza
de la costumbre que por otra causa, y cuando se levantó, quiso ir a
saludar, a volver a ver por algunos minutos, en el silencio de la
noche, por última vez, aquel cuarto donde había trabajado tanto
secretamente, con el corazón lleno de satisfacción y de ternura. Y
cuando se volvió a encontrar en la mesa, con la luz encendida, y vió
aquellas fajas blancas sobre las cuales no iba ya a escribir más
aquellos nombres de ciudades y de personas que se sabía de
memoria, le entró una gran tristeza e involuntariamente cogió la
pluma para reanudar el trabajo acostumbrado. Pero al extender la
mano tocó un libro y éste se cayó. Se quedó helado. ¡Si su padre se
despertaba...!. Cierto que no le habría sorprendido cometiendo
ninguna mala acción, y que él mismo había decidido contárselo todo;
sin embargo..., el oír acercarse aquellos pasos en la obscuridad, el
ser sorprendido a aquella hora con aquel silencio, el que su madre
se hubiese despertado y asustado, al pensar que por lo pronto su
padre hubiera experimentado una humillación en su presencia,
descubriéndolo todo... Todo esto casi lo aterraba. Aguzó el oído,
suspendiendo la respiración... No oyó nada. Escuchó por la cerradura
de la puerta que tenía detrás: nada. Toda la casa dormía. Su padre
no había oído. Se tranquilizó y volvió a escribir. Las fajas se
amontonaban unas sobre otras. Oyó el paso cadencioso de la
guardia municipal en la desierta calle; luego, ruido de carruajes, que
cesó al cabo de un rato; después, pasado algún tiempo, el rumor de
una fila de carros que pasaron lentamente; más tarde, silencio
profundo, interrumpido de vez en cuando por el ladrido de algún
perro. Y siguió escribiendo. Entretanto su padre estaba detrás de él;
se había levantado cuando se cayó el libro y esperó un rato; el ruido
de los carros había cubierto el rumor de sus pasos y el ligero chirrido
de las hojas de la puerta, y estaba allí, con su blanca cabeza sobre
la negra cabecita de Julio. Había visto correr la pluma sobre las
fajas, y en un momento todo lo había olvidado; lo había recordado y
comprendido todo, y un arrepentimiento desesperado, una ternura
inmensa había invadido su alma, y lo tenía clavado allí, detrás de su
hijo. De repente dió Julio un grito agudísimo: dos brazos convulsos
le habían cogido la cabeza. “¡Oh, padre mío, perdóname!”, gritó,
reconociendo a su padre llorando. “¡Perdóname tú a mí—respondió
el padre sollozando y cubriendo su frente de besos—. Lo he
comprendido todo, todo lo sé; yo soy quien te pide perdón, santa
criatura mía. ¡Ven, ven conmigo!”. Y le empujó, más bien que lo
llevó, a la cama de su madre, despierta, y arrojándolo entre sus
brazos, le dijo: “¡Besa a nuestro hijo, a este ángel, que desde hace
tres meses no duerme y trabaja por mí, y yo he contristado su
corazón mientras él nos ganaba el pan!”. La madre lo recogió y
apretó contra su pecho, sin poder articular una palabra, y después
dijo: “A dormir en seguida, hijo mío; ve a dormir y a descansar.
¡Llévalo a la cama...!”. El padre lo cogió en brazos, lo llevó a su
cuarto, lo metió en la cama, siempre jadeante y acariciándolo, y le
arregló las almohadas y la colcha. “Gracias, padre—repetía el hijo—,
gracias; pero ahora vete tú a la cama; ya estoy contento; vete a la
cama, papá”. Pero su padre quería verlo dormido, y sentado a la
cabecera de su cama, le tomó la mano y dijo: “¡Duerme, duerme,
hijo mío!”. Y Julio, rendido, se durmió por fin, y durmió muchas
horas, gozando por primera vez, después de muchos meses, de un
sueño tranquilo, alegrado por rientes ensueños; y cuando abrió los
ojos, después de un rato de alumbrar ya el sol, sintió primero y vió
después cerca de su pecho, apoyada sobre la orilla de la cama, la
blanca cabeza de su padre, que había pasado así la noche y dormía
aún, con la frente inclinada al lado de su corazón.
LA VOLUNTAD
Miércoles 28.—Hay en mi clase un tal Estardo, que sería capaz de
hacer lo que hizo el pequeño florentino. Esta mañana ocurrieron dos
acontecimientos en la escuela: Garofi, loco de alegría porque le
habían devuelto su álbum con el aumento de tres sellos de la
República de Guatemala, que él buscaba hacía tres meses, y
Estardo, que había obtenido la segunda medalla. ¡Estardo, el
primero en la clase después de Deroso! Todos nos admiramos.
¡Quién lo hubiera dicho en octubre, cuando su padre lo llevó a la
escuela metido en aquel gabán verde, y dijo al maestro delante de
todos: “Tenga con él mucha paciencia, porque es muy tardo para
comprender”. Todos al principio le creían un adoquín. Pero él dijo: “O
reviento, o salgo adelante”; y se puso a estudiar con fe, de día y de
noche, en casa, en la escuela y en el paseo, con los dientes
apretados y cerrados los puños, paciente como un buey, terco cual
un mulo, y así, a fuerza de machacar, no haciendo caso de las
bromas y pegando patadas a los revoltosos, ha pasado por delante
de los demás aquel testarudo. No comprendía una palabra de la
Aritmética; llenaba de disparates los apuntes; no acertaba a retener
en su memoria un período, y ahora resuelve problemas, escribe
correctamente y dice las lecciones como un papagayo. Se adivina su
voluntad de hierro cuando se ve su facha; tan grueso, con la cabeza
cuadrada y sin cuello, con las manos cortas y gordas y con aquella
voz áspera. Estudia hasta en las columnas de los periódicos y en los
anuncios de los teatros, y cada vez que junta dos reales se compra
un libro; ha reunido ya así una pequeña biblioteca, y en un
momento de buen humor se le escapó decirme que me llevaría a su
casa para verla. No habla con nadie, con nadie juega y siempre está
allí en su banco, con las manos en las sienes, firme como una roca,
oyendo al maestro. ¡Cuánto debe haber trabajado el pobre Estardo!
El maestro le dijo esta mañana, aunque estaba impaciente y de mal
humor cuando le dió la medalla: “¡Bravo, Estardo; quien trabaja,
vence!”. Pero él no parecía estar enorgullecido; no se sonrió, y
apenas volvió al banco con su medalla, tornó a apoyar las sienes en
los puños y se quedó más inmóvil que antes. Mas lo mejor fué a la
salida, que estaba esperándolo su padre, un sangrador grueso y
tosco como él, una facha con voz de trueno. Él no se esperaba
aquella medalla y no lo quería creer; fué menester que el maestro lo
asegurase, y entonces se echó a reír de gusto, y dió una palmada al
hijo en la cabeza, diciéndole en alta voz: “¡Bravo, bien, testarudo
mío!”. Y lo miraba atónito, sonriendo. Y todos los muchachos que
estaban alrededor se sonreían también, excepto Estardo. Éste
rumiaba ya en su cabeza la lección del día siguiente.
GRATITUD
Sábado 31.—“Tu compañero Estardo no se quejará nunca de su
maestro, estoy seguro; el profesor tiene mal genio y se impacienta,
tú lo dices como si fuese una cosa rara. Piensa cuántas veces te
impacientas tú; ¿y con quién? Con tu padre y con tu madre, con los
cuales tu impaciencia es un delito. ¡Bastante razón tiene tu maestro
para impacientarse alguna vez! Piensa en los años que hace que
lidia con muchachos, y que si hay muchos cariñosos y agradables,
encuentra también muchos ingratos que abusan de su bondad y
desconocen sus cuidados, y que, después de todo, entre tantos, son
más las amarguras que las satisfacciones. Piensa que el hombre más
santo de la tierra, puesto en su lugar, se dejaría llevar de la ira
alguna vez. Y después, si supieses cuántas veces el maestro va
enfermo a dar su clase, sólo porque no tiene una enfermedad
bastante grave para dispensarle de la asistencia a la escuela, y que
se impacienta porque sufre y le produce sentimiento ver que los
demás no lo advierten o abusan de él. Respeta y quiere a tu
maestro, hijo mío. Quiérelo porque tu padre lo respeta, porque
consagra su vida al bien de tantos niños que luego lo olvidan;
quiérelo porque te abre e ilumina la inteligencia y te educa el
corazón; porque un día, cuando seas hombre y no estemos ya en el
mundo ni él ni yo, su imagen se presentará a veces en tu mente al
lado de la mía, y entonces te acordarás de ciertas expresiones de
dolor y de cansancio de su cara apacible de hombre honrado, en la
cual ahora no te fijas; lo recordarás y te dará pena, aun después de
treinta años, y te avergonzarás; sentirás tristeza de no haberlo
querido bastante, de haberte portado tan mal con él. Quiere a tu
maestro, porque pertenece a esa gran familia de cincuenta mil
profesores elementales esparcidos por toda Italia, y que son como
los padres intelectuales de millones de muchachos que contigo
crecen; trabajadores mal comprendidos y mal recompensados, que
preparan para nuestra patria una generación mejor que la presente.
No estaré satisfecho de tu cariño hacia mí si no lo tienes igualmente
para todos los que te hacen bien, entre los cuales tu maestro es el
primero después de tu padre. Quiérelo como querrías a un hermano
mío; quiérelo cuando te acaricie y cuando te regañe; cuando es
justo contigo y cuando te parezca injusto; quiérelo cuando esté
alegre y afable, y quiérelo más aún cuando lo veas triste. Quiérelo
siempre. Pronuncia perpetuamente con respeto el nombre de
maestro, que, después del de padre, es el nombre más dulce que
puede dar un hombre a un semejante suyo.—Tu padre”.