Get Functional Python Programming: Use a functional approach to write succinct, expressive, and efficient Python code, 3rd Edition Lott free all chapters
Get Functional Python Programming: Use a functional approach to write succinct, expressive, and efficient Python code, 3rd Edition Lott free all chapters
com
https://textbookfull.com/product/functional-python-
programming-use-a-functional-approach-to-write-succinct-
expressive-and-efficient-python-code-3rd-edition-lott/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/
textboxfull.com
https://textbookfull.com/product/functional-programming-in-c-how-to-
write-better-c-code-1st-edition-enrico-buonanno/
textboxfull.com
Function Python programming discover the power of
functional programming generator functions lazy evaluation
the built in itertools library and monads Second Edition
Lott
https://textbookfull.com/product/function-python-programming-discover-
the-power-of-functional-programming-generator-functions-lazy-
evaluation-the-built-in-itertools-library-and-monads-second-edition-
lott/
textboxfull.com
https://textbookfull.com/product/python-projects-for-beginners-a-ten-
week-bootcamp-approach-to-python-programming-milliken/
textboxfull.com
https://textbookfull.com/product/teach-your-kids-to-code-a-parent-
friendly-guide-to-python-programming-1st-edition-bryson-payne/
textboxfull.com
https://textbookfull.com/product/effective-python-90-specific-ways-to-
write-better-python-2nd-edition-brett-slatkin/
textboxfull.com
Functional Python
Programming
Third Edition
Steven F. Lott
BIRMINGHAM—MUMBAI
“Python” and the Python logo are trademarks of the Python Software Foundation.
Functional Python Programming
Third Edition
Copyright © 2022 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held
liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing
cannot guarantee the accuracy of this information.
Python is an incredibly versatile language that offers a lot of perks for just about every
group. For the object-oriented programming fans, it has classes and inheritance. When
we talk about functional programming, it has functions as a first-class type, higher-order
functions such as map and reduce, and a handy syntax for comprehensions and generators.
Perhaps best of all, it doesn’t force any of those on the user – it’s still totally OK to write a
script in Python without a single class or function and not feel guilty about it.
Thinking in terms of functional programming, having in mind the goals of minimizing state
and side effects, writing pure functions, reducing intermediary data, and what depends on
what else will also allow you to see your code under a new light. It’ll also allow you to
write more compact, performant, testable, and maintainable code, where instead of writing
a program to solve your problem, you “write the language up”, adding new functions to
it until expressing the solution you designed is simple and straightforward. This is an
extremely powerful mind shift – and an exercise worth doing. It’s a bit like learning a
new language, such as Lisp or Forth (or German, or Irish), but without having to leave the
comfort of your Python environment.
Not being a pure functional language has its costs, however. Python lacks many features
functional languages can use to provide better memory efficiency and speed. Python’s
strongest point remains its accessibility – you can fire up your Python interpreter and
start playing with the examples in this book right away. This interactive approach allows
exploratory programming, where you test ideas easily, and only later need to incorporate
them into a more complex program (or not – like I said, it’s totally OK to write a simple
script).
This book is intended for people already familiar with Python. You don’t need to know
much about functional programming – the book will guide you through many common
approaches, techniques, and patterns used in functional programming and how they can
be best expressed in Python. Think of this book as an introduction – it’ll give you the basic
tools to see, think, and express your ideas in functional terms using Python.
Ricardo Bánffy
Steven has been working with Python since the ‘90s, building a variety of tools and
applications. He’s written a number of titles for Packt Publishing, include Mastering
Object-Oriented Python, Modern Python Cookbook, and Functional Python Programming.
He’s a technomad, and lives on a boat that’s usually located on the east coast of the US. He
tries to live by the words, “Don’t come home until you have a story.”
About the reviewers
Alex Martelli is a Fellow of the Python Software Foundation, a winner of the Frank
Willison Memorial Award for contributions to the Python community, and a top-page
reputation hog on Stack Overflow. He spent 8 years with IBM Research, then 13 years
at Think3 Inc., followed by 4 years as a consultant, and lately 17 years at Google. He
has taught programming languages, development methods, and numerical computing at
Ferrara University and other venues.
Books he has authored or co-authored include two editions of Python Cookbook, four
editions of Python in a Nutshell, and a chapter in Beautiful Teams. Dozens of his interviews
and tech talks at conferences are available on YouTube. Alex’s proudest achievement are
the articles that appeared in Bridge World (January and February 2000), which were hailed
as giant steps towards solving issues that had haunted contract bridge theoreticians for
decades, and still get quoted in current bridge-theoretical literature.
Tiago Antao has a BEng in Informatics and a PhD in Life Sciences. He works in the
Big Data space, analyzing very large datasets and implementing complex data processing
algorithms. He leverages Python with all its libraries to carry out scientific computing and
data engineering tasks. He also uses low-level programming languages like C, C++, and
Rust to optimize critical parts of algorithms. Tiago develops on an infrastructure based on
AWS, but has used on-premises computing and scientific clusters for most of his career.
While he currently works in industry, he also has exposure to the academic side of scientific
computing, with two data analysis postdocs at the universities of Cambridge and Oxford,
and a research scientist position at the University of Montana, where he set up, from
scratch, the scientific computing infrastructure for the analysis of biological data.
Preface xxi
Index 53
Preface
Functional programming offers a variety of techniques for creating succinct and expressive
software. While Python is not a purely functional programming language, we can do a
great deal of functional programming in Python.
Python has a core set of functional programming features. This lets us borrow many design
patterns and techniques from other functional languages. These borrowed concepts can
lead us to create elegant programs. Python’s generator expressions, in particular, negate
the need to create large in-memory data structures, leading to programs that may execute
more quickly because they use fewer resources.
We can’t easily create purely functional programs in Python. Python lacks a number of
features that would be required for this. We don’t have unlimited recursion, for example,
we don’t have lazy evaluation of all expressions, and we don’t have an optimizing compiler.
There are several key features of functional programming languages that are available
in Python. One of the most important ones is the idea of functions being first-class ob-
jects. Python also offers a number of higher-order functions. The built-in map(), filter(),
and functools.reduce() functions are widely used in this role, and less obvious are
functions such as sorted(), min(), and max().
In some cases, a functional approach to a problem will also lead to extremely high-
performance algorithms. Python makes it too easy to create large intermediate data
structures, tying up memory (and processor time). With functional programming de-
sign patterns, we can often replace large lists with generator expressions that are equally
expressive but take up much less memory and run much more quickly.
xxii Preface
We’ll look at the core features of functional programming from a Python point of view.
Our objective is to borrow good ideas from functional programming languages and use
those ideas to create expressive and succinct applications in Python.
This is not intended as a tutorial on Python. This book assumes some familiarity with the
language and the standard library. For a foundational introduction to Python, consider
Learn Python Programming, Third Edition: https://www.packtpub.com/product/learn-p
ython-programming-third-edition/9781801815093.
While we cover the foundations of functional programming, this is not a complete review of
the various kinds of functional programming techniques. Having an exposure to functional
programming in another language can be helpful.
• Library modules to help create functional programs. This is the subject of the
remaining chapters of the book. Chapter 12 includes both fundamental language and
library topics.
Chapter 2, Introducing Essential Functional Concepts, delves into central features of the
functional programming paradigm. We’ll look at each in some detail to see how they’re
implemented in Python. We’ll also point out some features of functional languages that
don’t apply well to Python. In particular, many functional languages have complex type-
matching rules required to support compiling and optimizing.
Chapter 3, Functions, Iterators, and Generators, will show how to leverage immutable Python
objects, and how generator expressions adapt functional programming concepts to the
Python language. We’ll look at some of the built-in Python collections and how we can
leverage them without departing too far from functional programming concepts.
Chapter 4, Working with Collections, shows how you can use a number of built-in Python
functions to operate on collections of data. This chapter will focus on a number of relatively
simple functions, such as any() and all(), which reduce a collection of values to a single
result.
Chapter 6, Recursions and Reductions, teaches how to design an algorithm using recursion
and then optimize it into a high-performance for statement. We’ll also look at some other
reductions that are widely used, including collections.Counter().
Chapter 7, Complex Stateless Objects, showcases a number of ways that we can use immutable
tuples, typing.NamedTuple, and the frozen @dataclass instead of stateful objects. We’ll
also look at the pyrsistent module as a way to create immutable objects. Immutable
objects have a simpler interface than stateful objects: we never have to worry about
abusing an attribute and setting an object into some inconsistent or invalid state.
Chapter 8, The Itertools Module, examines a number of functions in the itertools standard
library module. This collection of functions simplifies writing programs that deal with
collections or generator functions.
xxiv Preface
Chapter 9, Itertools for Combinatorics – Permutations and Combinations, covers the combina-
toric functions in the itertools module. These functions are more specialized than those
in the previous chapter. This chapter includes some examples that illustrate ill-considered
use of these functions and the consequences of combinatoric explosion.
Chapter 10, The Functools Module, focuses on how to use some of the functions in the
functools module for functional programming. A few functions in this module are more
appropriate for building decorators, and they are left for Chapter 12, Decorator Design
Techniques.
Chapter 11, The Toolz Package, covers the toolz package, a number of closely related
modules that help us write functional programs in Python. The toolz modules parallel
the built-in itertools and functools modules, providing alternatives that are often more
sophisticated and make better use of curried functions.
Chapter 12, Decorator Design Techniques, covers how we can look at a decorator as a way
to build a composite function. While there is considerable flexibility here, there are also
some conceptual limitations: we’ll look at ways that overly complex decorators can become
confusing rather than helpful.
Chapter 13, The PyMonad Library, examines some of the features of the PyMonad library.
This provides some additional functional programming features. It also provides a way to
learn more about monads. In some functional languages, monads are an important way to
force a particular order for operations that might get optimized into an undesirable order.
Since Python already has strict ordering of expressions and statements, the monad feature
is more instructive than practical.
Chapter 14, The Multiprocessing, Threading, and Concurrent.Futures Modules, points out
an important consequence of good functional design: we can distribute the processing
workload. Using immutable objects means that we can’t corrupt an object because of poorly
synchronized write operations.
Chapter 15, A Functional Approach to Web Services, shows how we can think of web services
as a nested collection of functions that transform a request into a reply. We’ll see ways to
Preface xxv
leverage functional programming concepts for building responsive, dynamic web content.
Chapter 16, A Chi-Squared Case Study, is a bonus, online-only case study applying a number
of functional programming techniques to a specific exploratory data analysis problem. We
will apply a 𝜒 2 statistical test to some complex data to see if the results show ordinary
variability, or if they are an indication of something that requires deeper analysis. You can
find the case study here: https://github.com/PacktPublishing/Functional-Python-P
rogramming-3rd-Edition/blob/main/Bonus_Content/Chapter_16.pdf.
Some of the examples use exploratory data analysis (EDA) as a problem domain to show
the value of functional programming. Some familiarity with basic probability and statistics
will help with this. There are only a few examples that move into more serious data science.
Python 3.10 is required. The examples have also been tested with Python 3.11, and work
correctly. For data science purposes, it’s often helpful to start with the conda tool to create
and manage virtual environments. It’s not required, however, and readers should be able
to use any available Python.
Additional packages are generally installed with pip. The command looks like this:
In some cases, the reader will notice that the code provided on GitHub includes partial
solutions to some of the exercises. These serve as hints, allowing the reader to explore
alternative solutions.
In many cases, exercises will need unit test cases to confirm they actually solve the problem.
These are often identical to the unit test cases already provided in the GitHub repository.
The reader should replace the book’s example function name with their own solution to
confirm that it works.
In some cases, the exercises suggest writing a response document to compare and contrast
multiple solutions. It helps to find a mentor or expert who can help the reader by reviewing
these small documents for clarity and completeness. A good comparison between design
approaches will include performance measurements using the timeit module to show the
performance advantages of one design over another.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in the text, database table names, folder names, filenames,
file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example:
“Python has other statements, such as global or nonlocal, which modify the rules for
variables in a particular namespace.”
Preface xxvii
Bold: Indicates a new term, an important word, or words you see on the screen, such as in
menus or dialog boxes. For example: “The base case states that the sum of a zero-length
sequence is 0. The recursive case states that the sum of a sequence is the first value plus
the sum of the rest of the sequence.”
print("Hello, World!")
Get in touch
Feedback from our readers is always welcome.
General feedback: Email feedback@packtpub.com, and mention the book’s title in the
subject of your message. If you have questions about any aspect of this book, please email
us at questions@packtpub.com.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you have found a mistake in this book we would be grateful if you would
report this to us. Please visit https://subscription.packtpub.com/help, click on the
Submit Errata button, search for your book, and enter the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet,
xxviii Preface
we would be grateful if you would provide us with the location address or website name.
Please contact us at copyright@packtpub.com with a link to the material.
If you are interested in becoming an author: If there is a topic that you have ex-
pertise in and you are interested in either writing or contributing to a book, please visit
http://authors.packtpub.com.
https://packt.link/r/1803232579
Your review is important to us and the tech community and will help us make sure we’re
delivering excellent quality content.
Other documents randomly have
different content
On meeting the lord d'Escaillon, who had about sixty horsemen with
him, she took the road to Calais, and rode this first day as far as
Hêdin, near to St. Pol, and thence strait to Calais, whence, after
some stay, she crossed over to England, where she was most
honourably received by the king, who made her general promises of
aid in all her concerns.
CHAP. LI.
THE DUKE OF BRITTANY IS MADE PRISONER BY THE
COUNT DE PENTHIEVRE, AND DETAINED BY HIM FOR A
CONSIDERABLE TIME.—A WAR TAKES PLACE IN
CONSEQUENCE THEREOF.
WE must now speak of a wonderful event that happened this year
in Brittany. It has been told by some historians, especially by master
John Froissart, how the ancestors of John de Montfort, the present
duke of Brittany, and those of Olivier de Bretagne, count de
Penthievre, had in former times great quarrels and wars respecting
the succession to the dukedom of Brittany, each of them claiming it
as his right.
At length, the duchy was given up to the Montforts, by means of
certain compensations that were made to the family of Penthievre,
the mention of which I shall pass over, as these events are anterior
to my history, and they had possessed the duchy peaceably ever
since.
The present count de Penthievre, however, notwithstanding he
showed great outward marks of affection to the duke of Brittany,
had not forgotten these ancient quarrels, as you will soon perceive.
In truth, what with the hope of regaining the duchy, and with the
exhortations of his mother, who was daughter to the late sir Olivier
de Clisson, constable of France, the count de Penthievre obtained a
sealed order from the dauphin to arrest and imprison the duke of
Brittany; although he was married to his sister; but he was ill
pleased with the duke, because he and the estates of the duchy had
refused to assist him in his war against the English and Burgundians.
When the count had obtained this order, he considered how he could
the most easily carry it into effect, and thought his best way would
be to invite the duke to dinner at Chantoceau. He went, therefore, to
pay a visit to the duke at Nantes; and after some conversation, he
earnestly pressed him to come and amuse himself at Chantoceau,
and dine there, adding, that his mother would be delighted to see
him, and would entertain him to the best of her power. The duke
consented to both proposals, not imagining that any evil designs
could have been devised against him, and the day fixed on was the
4th of February.
When that day was come, the duke set out from le Lorrons
Bocqteriaux, where he had slept, and took the road to Chantoceau.
His maitres d'hôtel and harbingers preceded him, as is customary, to
have all things in readiness for him on his arrival. When they
appeared before the castle, the count and all his household mounted
their horses, and advanced to meet the duke so far as a bridge
called the Bridge à la Tuberbe, which is thrown over a small river.
The duke crossed this bridge, accompanied by his brother Richard,
and some knights and esquires of his household, followed at a
distance by the rest of his attendants, for he never suspected the
mischief that was intended him. When he had passed the bridge,
one of the count's attendants who counterfeited being a fool,
dismounted and threw the planks of the bridge into the water by
way of amusement, which prevented the retinue of the duke that
had remained behind from crossing it.
The duke, still unsuspecting, laughed heartily at this trick of the fool;
but in the mean time, Charles lord of Avaugour, brother to the count,
who had lain in ambush with about forty men at arms, sallied out
against the duke, who, seeing this, said to the count, 'Fair cousin,
what means this? and who are these people?' 'My lord, they are my
people, and I arrest you in the name of the dauphin,' at the same
time laying hands on him. The duke, greatly surprised, said, 'Ah! fair
cousin, you act wickedly; for I came hither at your request, not
suspecting you had any evil designs.'
Some of his people, however, drew their swords in his defence; but
they soon perceived they were too inferior in numbers to do any
good. At the same time, those who had been placed in ambuscade
advanced on the duke with drawn swords, when one of the duke's
gentlemen, called John de Beaumanoir, had his wrist cut through,
and another, named Thibault Buisson was wounded in the hand. One
of the count's household, called Henry l'Alemand, wanted to strike
the duke with his sword; but the count defended him, and ordered
his men to cease fighting, for that he should carry the duke prisoner
to the dauphin.
The duke's attendants on the other side of the bridge, seeing the
situation of their lord, were much distressed that they could not
come to his aid, and knew not how to act. Shortly after, the count de
Penthievre, his brother, and his men at arms hastily carried off the
duke and his brother Richard toward Poitou, to Bressaire, and thence
to Lusignan, to Bournouiau, to Châteaumur, and other places. He
was thus a prisoner for six or seven months, without being confined
in any prison or treated personally ill; but he was closely watched,
and had only one of his domestics to wait on him. His brother
Richard was detained a prisoner with him.
You may suppose, that when the knowledge of this arrest of the
duke was made known to the duchess and lords of Brittany, they
were highly incensed: in particular, the duchess was so grieved that
it was with difficulty she could be appeased. The whole of the
nobility were speedily assembled, with the duchess, in the town of
Nantes, when they solemnly resolved, on oath, to proceed to the
deliverance of the duke, and to make war on the count de
Penthievre, and on all his friends, allies, and wellwishers. They
unanimously chose the lords de Châteaubriant and de Rieux as their
commanders, who instantly marched a powerful force against
Lamballe, which belonged to the count. It held out for fifteen days,
and then surrendered; and the castle and town, which were strongly
fortified, were destroyed, and the walls razed. They thence marched
to castle Andren, and to la Motte d'Ebron, which were treated in the
same manner.
They proceeded to lay siege to Chantoceau, in which was the old
countess de Penthievre. The governor was the lord de Bressieres,
who defended it well. This siege lasted three months, without much
being gained by the besiegers; for it was amply supplied with
provision and stores, and well garrisoned by good men at arms.
During this siege, a treaty was made, between the count and the
duke, who promised to restore all his places, as well those that had
been taken as those that had been demolished, and that he would
not, by himself or his friends, any way molest him for what he had
done. When this treaty had been concluded, and hostages given for
its performance, the count sent back the duke, escorted by the lord
de l'Esgle his brother.
The first act of the duke was to raise the siege of Chantoceau; but
when the barons of Brittany had again possession of their duke, they
refused to comply with the treaty he had made, and insisted that the
countess of Penthievre should depart from Chantoceau, and that the
place should be put into the hands of the duke.
A day of conference was appointed between the two parties, to see
if any terms could be thought of to put an end to these differences;
and the count promised to attend in person, giving his brother
William as an hostage for his keeping his promise: but he did not
appear, having had sure information, that if he did come, he would
never return. In truth, had he appeared, he would have been
executed judicially, for it had been so determined on by the three
estates of the duchy; and they told the duke, that if he meant to
keep the treaty made with the count de Penthievre, they would
deprive him of the dukedom, and elect his eldest son duke in his
stead, so that he was obliged to comply with their wills.
The count de Penthievre, on hearing these things, was much
troubled, and not without cause; for he knew that all his landed
property and lordships in Brittany were confiscated and in
possession of the duke, and that his brother remained as hostage in
the hands of the duke, without a possibility of his deliverance.
On the other hand, he was on bad terms with the dauphin, because
he would not give up to him the person of the duke of Brittany,—and
was not very safe as to himself; for he found few willing to support
him. To avoid greater inconveniences, he withdrew into the
viscounty of Limoges, and after some consultations with his
brothers, departed thence through the country of Auvergne to Lyon,
and thence to Geneva and Basil, on his way to his possessions at
Avesnes in Hainault. As he was travelling down the Rhine, he was
arrested by the marquis of Baden, by way of reprisal for the pillaging
of some of his people in Hainault, and was detained a long time
prisoner. To obtain his liberty, it cost him full thirty thousand crowns;
after which, he went to Avesnes in Hainault.
While he resided at Avesnes, the duke of Brittany sent some of his
people thither to arrest him, and put an iron chain round his neck.
They were under the conduct of the following breton gentlemen: sir
Roland de Saint Pol, sir John de Lumon, Jacquet de Faulermine, and
others; but they managed the matter with so little secresy that their
enterprise was known, and some were imprisoned. The rest saved
themselves by flight. The count was forced to surrender the
prisoners to the judicial court of Mons, and none were executed.
The count de Penthievre never returned to Brittany, but remained all
his days in Hainault, and married the daughter and heiress of the
lord de Quievrain, by whom, at his decease, he left several children,
who did not, however, live until of competent age, so that his estates
descended to his brother, the lord de l'Esgle.
CHAP. LII.
THE DAUPHINOIS RETAKE VILLENEUVE-LE-ROI.—THE
LORD DE CHASTILLON CONQUERS CHASTEAU-THIERRY,
AND MAKES LA HIRE PRISONER.
IN the month of February, the Dauphinois regained the town of
Villeneuve-le-Roi; but shortly after, the lord de l'Isle-Adam, with
others of the burgundian captains, quartered themselves in all the
adjoining villages, by way of blockading it. They, however, only
remained a certain time, and then decamped without subjecting the
town to their obedience, which caused the country around to suffer
much. A treaty was, however, made with the governor to allow
provision to be brought unmolested to Paris, on paying certain taxes,
of which he was to have his share.
At this same time, Château-Thierry, with its castle, was delivered into
the hands of the lord de Châtillon, though garrisoned by the
Dauphinois, by means of some of the inhabitants, in which La Hire
and many of his men were made prisoners, but were set at liberty
afterward on ransom.
During this period, the Dauphinois-garrisons at Meaux in Brie, at
Compiègne, Pierrefons, and on the borders of the Valois, destroyed
all the country round by their inroads, more especially the
Beauvoisis, the Vermandois, and Santerre. In like manner did those
quartered in the country of Guise to the inhabitants of Hainault, the
Cambresis, and the adjacent parts.
While these troubles lasted, from the year 1415 to 1420, the money
in France was greatly lowered in value, insomuch that a gold crown
from the king's mint was worth twenty-nine sols in the money of the
day, although it had been coined for eighteen sols parisis, which very
much affected those lords whose rents were payable in money, and
caused several law-suits between the parties, on account of the said
diminution of the coin, when a horse-load of wheat was worth from
seven to eight francs.
CHAP. LIII.
THE DAUPHIN IS SUMMONED BY THE PARLIAMENT TO
APPEAR AT THE TABLE OF MARBLE.—THE DUKE OF
EXETER ARRESTS THE LORD DE L'ISLE-ADAM IN PARIS.
IN this year, before king Henry left Paris to re-cross the sea, he
caused Charles duke of Touraine and dauphin to be summoned to
appear before the parliament at the table of marble, with all the
usual ceremonies and solemnities to answer for himself and his
accomplices to the charges made against him and them, respecting
the murder of the late John duke of Burgundy. And because he
neither appeared himself, nor sent any one, he was by the council
and parliament publicly banished the realm, and declared incapable
of succeeding to any lands or lordships, at present or in times to
come,—and even to the succession of the crown of France,
notwithstanding he was the true and lawful heir after the decease of
his father king Charles, according to the laws and usages of the
realm.
From this sentence, he made an appeal to his sword. Numbers of
the Parisians were greatly pleased at his banishment, for they much
feared him.
The duke of Exeter, governor of Paris, for certain reasons best
known to himself, ordered the lord de l'Isle-Adam to be arrested by
some of his English, which caused a thousand or more of the
commonalty of Paris to rise in order to rescue him from those who
were carrying him to the Bastille. But the duke of Exeter sent six
score combatants, the greater part of whom were archers, to
support them; and they by their arrows, and by proclaiming that
what they were about was by the king's order, created so great an
alarm, that the people retired to their houses, and the lord de l'Isle-
Adam remained prisoner to the king of England so long as he lived.
He would indeed have had him put to death, if the duke of Burgundy
had not greatly interested himself in his behalf.
CHAP. LIV.
THE DUKE OF CLARENCE IS DEFEATED BY THE
DAUPHINOIS NEAR TO BAUGEY.—IN THIS ENGAGEMENT,
GREAT NUMBERS OF THE NOBLES AND GENTLEMEN OF
EACH PARTY ARE SLAIN.
THE duke of Clarence, who had been appointed governor-general of
all Normandy on the departure of his brother king Henry for
England, marched his army, on Easter-eve, toward the country of
Anjou, to combat a large body of the Dauphinois under the
command of the earl of Buchan, constable to the dauphin, the lord
de la Fayette and several others. It happened, that on this day, the
duke heard that his enemies were near him at a town called Baugey
in Anjou; on which, being very renowned in arms, he instantly
advanced thither a part of his force, particularly almost all his
captains, when a very severe and bloody conflict ensued. The body
of his army followed with much difficulty at a distance on account of
a dangerous river they had to ford.
On the other hand, the Dauphinois, who had been advertised of
their approach, fought so manfully that in the end they obtained the
victory over the English. The duke of Clarence, the earl of Kyme, the
lord Roos, marshal of England, and in general the flower of his
chivalry and esquiredom were left dead on the field, with two or
three thousand common men. The earls of Somerset and of
Huntingdon, the count du Perche, with two hundred others, were
made prisoners.
The Dauphinois lost from a thousand to eleven hundred men: in the
number were a gallant knight called Charles le Bouteiller, sir John
Yvorin, Garin des Fontaines, sir John de Passavant, sir John de Bulle,
sir John Totavant, with other persons of note, amounting in the
whole to the number before specified. From that time forward, the
affair of this day was called the battle of Baugey.
The English were much cast down at this defeat, and particularly
lamented the death of the duke of Clarence, who was much beloved
by them for his valour and prudence. They, however, under the
command of the earl of Salisbury, recovered the body of the duke,
which was carried to Rouen, and thence transported to England,
where it was buried with great solemnity.[7]
FOOTNOTES:
[7] This battle took place on Easter-eve 1421. The duke of
Clarence's remains were recovered by his son John, bastard of
Clarence, and interred in the cathedral church at Canterbury,—the
duke having by his will, dated July 1417, directed that his body
should be buried at the feet of that of his father, king Henry IV.
The lady Margaret Holland, daughter to Thomas Holland earl of
Kent, married first to John Beaufort earl of Somerset, and
secondly to Thomas duke of Clarence, had a splendid tomb
erected over his body in her life time. She died in December
1440.
[a.d. 1421.]
CHAP. LV.
THE DAUPHINOIS ADVANCE TO ALENÇON: THE ENGLISH
MARCH THITHER ALSO.—THE MARRIAGE OF THE DUKE
OF ALENÇON,—AND OTHER MATTERS.
AT the beginning of this year, after the death of the duke of
Clarence, the Dauphinois, elated with their victory at Baugey,
assembled a large force to besiege Alençon, and in fact lodged
themselves very near to the walls, combating the garrison with all
their might.
The English, notwithstanding their grief at their late loss, detached
parties from their different garrisons in Normandy, under the
command of the earl of Salisbury, to Alençon, to offer battle to the
enemy, and force them to raise the siege. But the Dauphinois having
had, as before, intelligence of their motions, drew up in battle-array
before their quarters, with every appearance of courage. When the
English perceived how numerous they were, they retreated to the
abbey of Bec, but not without losing, in killed and taken, from two to
three hundred men, for they were pursued as far as the abbey. The
Dauphinois, however, finding they could not gain Alençon without
great loss of men, marched away, leaving every thing behind them,
and returned to Anjou and Dreux.
In these days, a marriage was concluded between the duke of
Alençon and the only daughter of the duke of Orleans, a prisoner in
England. It was celebrated at the town of Blois, and had been chiefly
brought about by the dauphin, to whom she was niece, and the
duke of Brittany, uncle to the duke of Alençon.
When news of the death of the duke of Clarence reached king Henry
in England, he was greatly troubled thereat, as well as at the loss of
his other nobles and men, and hastened his preparations to return
with an army to France, to take vengeance on the Dauphinois, who
had thus grieved him at heart.
CHAP. LVI.
SIR JAMES DE HARCOURT BEGINS A WAR ON THE
VASSALS AND COUNTRIES OF THE DUKE OF BURGUNDY.
—THE INCONVENIENCES THAT ARISE FROM THIS
CONDUCT.
ABOUT this time, sir James de Harcourt, who resided at Crotoy,
whence, as has been said, he made war on the English, abstained
from having any communication with the duke of Burgundy, or with
those of his party: he even seized in the port of Estaples a vessel
laden with corn, that belonged to sir Hemon de Bouberch, who was
attached to the duke of Burgundy. Because he refused to restore it,
on being summoned, a sudden war broke out between them, very
prejudicial to the whole country of Ponthieu and the adjoining parts.
Sir Hemon, in revenge, went and made his complaints to sir William
Balledo, lieutenant of Calais, who instantly collected soldiers from
the county of Guines, and from his garrison, and carried them by sea
to Crotoy,—when, having burnt all the vessels and boats in the
harbour, he returned to Calais.
In return for this enterprise, sir James forced an entrance into many
of the towns of sir Hemon, which he completely plundered, and
carried away the pillage to his garrisons of Noyelle and Crotoy.
Shortly after, sir Hemon did the same to the towns of sir James de
Harcourt, and the war was carried on with such bitterness that the
whole of that country suffered greatly; for sir James, to strengthen
himself, obtained reinforcements of men at arms from Compiègne
and elsewhere. He also formed an alliance with many of the nobles
of Vimeu and Ponthieu, with the lord de Rambures, Louis de
Vaucourt, le bon de Saveuses, Perceval de Houdent, Pierre Quieret,
governor of D'araines, and with many others.
Sir James, by this means, gained possession of several towns and
castles, such as the town of St Riquier, the castle of la Ferté, and of
Drugy, the island and castle of Pont de Remy, the fortresses of
D'araines, Diaucourt, and Moreul: on the side of the country toward
St Valery, Rambures, Gamaches, and some others, into which, by the
exertions of sir James, parties of the Dauphinois gained admittance,
who began to make open war on the duke of Burgundy and his
adherents, to the ruin of the country. The town of St Riquier,
however, did not submit to sir James, until the king Henry had
crossed from England to France, as you shall hear.
CHAP. LVII.
KING HENRY OF ENGLAND RETURNS TO FRANCE WITH A
POWERFUL ARMY TO COMBAT THE DAUPHIN, WHO HAD
BESIEGED CHARTRES.
WHEN king Henry had settled the government of England during his
absence, and when his army was advanced to Canterbury, having
received pay for eight months, he came to Dover; and thence, and
at the neighbouring ports, he and his army embarked at day-break,
on the feast of St Barbara, and that same day arrived in the harbour
of Calais at two o'clock in the afternoon.
The king disembarked from his vessel and was lodged in the castle
of Calais; the others landed also, and were quartered in the town
and the adjacent parts, according to the orders of the king and his
harbingers. Shortly after, when the vessels were unladen, they were
discharged, and ordered back by the king to England. It was
estimated by competent judges that from three to four thousand
men at arms disembarked that day, and full twenty-four thousand
archers.
On the morrow of the feast of St Barbara, the king sent the earl of
Dorset and the lord Clifford to the assistance of his uncle the duke of
Exeter and the Parisians, who were much straitened for provisions
by the garrisons of the Dauphinois that surrounded Paris. They had
under their command twelve hundred combatants, and, avoiding all
the ambushes of the enemy, rode hastily forward to Paris, where
they were joyfully received by the inhabitants, by reason of the
intelligence they brought of the king of England being at Calais, to
whom they had sent several messages before he left England.
The dauphin had now a considerable army, which he marched
toward Chartres; and the towns of Bonneval and Galardon, with
other castles, surrendered to him, which he regarrisoned, and then
fixed his quarters as near to Chartres as possible, and encompassed
it on all sides. It was defended by the bastard de Thian and other
captains, who had been dispatched thither in haste from Paris for
that purpose.
The dauphin's army was supposed to consist of from six to seven
thousand having leg-armour, four thousand cross-bows and six
thousand archers, and this statement was sent to the king of
England by those who had seen them. The Dauphinois erected many
engines to batter the walls and gates, which did some mischief; but
as the inhabitants were assured of being speedily relieved by king
Henry, they were not under any alarm at their attacks.
CHAP. LVIII.
THE KING OF ENGLAND MARCHES FROM CALAIS,
THROUGH ABBEVILLE, TO BEAUVAIS, AND THENCE TO
MANTES, WHERE THE DUKE OF BURGUNDY MEETS HIM.
WHEN king Henry had remained some days in Calais on account of
business, he departed in haste; for he had received pressing
solicitations from his uncle the duke of Exeter and the Parisians that
he would succour Chartres. Taking his march by the sea side, he was
lodged at the hôtel of the Crown in Montrieul, and his army
quartered in the low lands near it. Philip duke of Burgundy had
arrived there the preceding day to confer with the king; but as he
was confined with a fever, and unable to mount his horse, he sent sir
John de Luxembourg, with all his chivalry, to meet the king, and
make his excuses for not coming himself in person.
They remained for three days in this town to confer at leisure on the
present state of affairs. They departed together, and went to lodge
at Douvast in Ponthieu. As they marched near to Montenay, the king
of England ordered the tower, house and mill of sir James de
Harcourt to be burnt.
The king was desirous of crossing the Somme at Abbeville, and the
duke of Burgundy advanced to that town to negotiate the king's
passage, which was obtained, but very unwillingly, on the duke
promising that every expense should be fully discharged.
While the duke was absent, the king and his nobles amused
themselves in hunting in the forest of Cressy, and the following day
fixed their quarters at St Riquier, near to which place was a small
fort called La Ferté, garrisoned by about sixty of sir James de
Harcourt's men, under the command of the bastard de Bellay, who,
on a formal summons, surrendered the place.
A gentleman of the country, called Nycaise de Boufflers, was
appointed by the king and the duke governor, who shortly after
yielded it to the Dauphinois (as will be hereafter related), by whom it
had before been held.
From St Riquier, king Henry came to Abbeville, where he was most
honourably received, and many handsome presents were made him,
in compliment to the duke of Burgundy. The army and baggage
passed very peaceably through the town; and on the morrow, when
all the expenses had been paid, the king took leave of the duke, on
his promising that he would speedily join him with his whole force.
King Henry continued his march through Beauvais and Gisors, to the
castle of Vincennes, where were the king and queen of France,
whom he saluted most respectfully, and was by them received with
great joy. Thither came his uncle the duke of Exeter, with several of
the council of the king of France, and many conferences were held
on the present state of the kingdom.
Among other things, it was ordered, that the florettes, a coin of the
king, which was current for sixteen deniers, should be reduced to
three deniers; but when this ordinance was proclaimed throughout
the kingdom, it created great murmurings against the ministers
among the commonalty of Paris, and in other places, but without
obtaining any redress. Their murmurings were soon after much
increased by the coin being still lowered in currency.
The king of England now assembled a very large army; and in
conjunction with that he had brought with him from England, he
marched toward Mantes to offer battle to the dauphin, who had
been already seven weeks before Chartres. He sent to the duke of
Burgundy to join him instantly with as many men as he could raise,
that he might be in time for the day of battle. The duke made all
haste to comply, and advanced to the town of Amiens with about
three thousand combatants, and thence, marching through Beauvais
and Gisors, came to the town of Mantes. He, however, left his army
at a large village, and went himself, with few attendants, to wait on
the king of England, who was well pleased with his diligence.
In the interim, the dauphin, when he was informed of the great
army that was marching against him, broke up his siege of Chartres,
and retreated to Tours.
When the king and the duke of Burgundy had held several councils
on their further proceedings, it was agreed, that the duke should
return to Picardy to oppose the Dauphinois, who were doing great
mischief there by means of the influence of sir James de Harcourt.
CHAP. LIX.
THE LORD D'OFFEMONT ENTERS ST RIQUIER.—THE
ADVENTURE OF THE LORD DE COHEN, GOVERNOR OF
ABBEVILLE.—OTHER EVENTS THAT HAPPENED IN THESE
TIMES.
DURING the time that the duke of Burgundy was on his march, and
when he was with the king of England, the lord d'Offemont and
Poton de Saintrailles collected about twelve hundred horse, and,
passing through Vimeu, crossed the Somme at Blanchetaque, where
they were met by sir James de Harcourt: they thence proceeded to
St Riquier, and gained admittance into the town through the
influence of sir James.
They treated successfully with Nycaise de Boufflers for the surrender
of the castle of La Ferté, which was given up to them, as was that of
Drugy, belonging to the abbot of St Riquier. When they had
established themselves in these places, they overran the adjacent
country, and even sailed on the river Canche, to a large village called
Conchy, and completely burnt the whole, together with a very
handsome church, into which the principal inhabitants had retreated
with their effects, the greater part of whom were led prisoners to St
Riquier.
In another part, the strong fort of Dourier proudly seated on the
river Authie, was surrendered to Poton de Santrailles; and, by means
of this acquisition, the town and neighbourhood of Montrieul were
greatly harrassed.
The duke of Burgundy heard, on his return with his army, at a town
called Croissy, that the lord d'Offemont and Poton de Santrailles had
gained possession of St Riquier, and how they were proceeding. On
this he assembled his council; and it was determined that men at
arms should be summoned from all parts, and cross-bowmen from
the towns under the dominion of the king of France, that St Riquier
might be besieged. With this intent he went to Amiens, and solicited
succours, which were granted to him. He thence dispatched his
messengers to different towns, to make similar requests: the greater
part of them promised to serve him liberally.
When the duke departed from Amiens, he went through Dourlens, to
fix his quarters at Auxi, on the river Authie, within three leagues of
Saint Riquier. He was there rejoined by sir John de Luxembourg, who
had been detached with a certain number of combatants, through
Dourmart in Ponthieu, toward St Riquier, to make inquiry as to the
number and situation of the Dauphinois.
The duke remained three days at Auxi, to wait the arrival of his
reinforcements. While these things were passing, the lord de Cohen,
governor of the town of Abbeville, going one night after supper to
visit the guard, attended by only six persons, but preceded by his
servants, carrying lighted torches, was suddenly attacked by three or
four persons, who were lying in wait for him, and severely wounded
him in the face. They also struck an advocate, called John de Quex,
who was in his company, mounted on a handsome horse: he was
stunned with the blow, and, in his fright, stuck spurs into his horse,
who galloped off against a chain that had been stretched across the
street from two posts. One of them, by the great strength of the
horse, was torn from the ground, but the shock flung the advocate
with such force that he died shortly after, of the bruises. The lord de
Cohen was carried home by his servants, thus wounded, and was
unable at first to discover the perpetrators of this deed. They were,
however, of Abbeville, and, by means of friends, escaped secretly,
and went to Crotoy, to relate what they had done to sir James de
Harcourt, who was well pleased thereat, and retained them in his
service. Some few years afterward, however, they were taken, and
executed for this and other crimes.
CHAP. LX.
THE DUKE OF BURGUNDY MARCHES TO PONT DE SAINT
REMY, AND CONQUERS IT.—THE DEEDS OF ARMS THAT
WERE PERFORMED BEFORE SAINT RIQUIER.
THE duke of Burgundy advanced his whole army from Auxi to a
large village called Viurens, within a league from St Riquier. On the
morrow, he marched by this last town, and quartered himself and
his army at Pont de St Remy, on the night of the feast of the
Magdalen. Some of his men were lodged in large houses near the
bridge; but the Dauphinois, who were in the castle and island,
discharged rockets into them, and set them on fire, which forced the
Burgundians to retire, and fix their quarters further off.
Two days after their arrival, the cross-bows from Amiens, and a body
of men at arms who escorted them, descended the Somme in twelve
boats, ready to attack the castle and island. But the Dauphinois, on
learning that they were near at hand, took fright, and, packing up
their baggage, fled to the castle of D'airaines, leaving Pont de St
Remy without any guard. Some women, who had remained in the
island, lowered the drawbridge on the side where the Burgundians
lay, who instantly entered the place, and plundered all that the
Dauphinois had left.
This same day, by orders from the duke of Burgundy, the castle and
town were burnt, wherein were many handsome houses. In like
manner, on this and on the following day, were destroyed the castles
of Marveil and Jaucourt, which the Dauphinois had deserted from
fear of the duke.
While the duke of Burgundy was thus employed at Pont de St Remy,
sir John de Luxembourg went to the town of St Riquier, under proper
passports from the lord d'Offemont, with one hundred picked men at
arms, as an escort to six knights, well mounted and accoutred, who
were to perform a deed of arms against six champions of the
Dauphinois, under the lord d'Offemont.
This combat had been previously settled by messages which had
passed between the parties. The burgundian champions were Henry
l'Allemant, the bastard de Robaix, Lyonnet de Bournouville and three
others. The Dauphinois were the lord de Verduysant, Guillaume
d'Aubigny and four others, whose names I have forgotten. On the
parties meeting, the justings commenced; but, at the onset, the two
Dauphinois killed the horses of their opponents: the others broke
several lances gallantly enough; but from the shortness of the time
two on each side could not just,—and there was no one wounded on
either side. The parties took a friendly leave; and sir John de
Luxembourg returned with his company to the Pont de St Remy, and
the lord d'Offemont re-entered St Riquier.
Sir John de Luxembourg had been accompanied for his security, by
one hundred of the most expert men at arms in the burgundian
army: he had also formed an ambuscade of three hundred men in a
wood to succour him, should there be occasion. When on his road to
St Riquier, having placed this ambuscade, he halted on an eminence
to observe if his orders were obeyed, and to his surprise saw that
those in ambush were wandering about and the horses grazing. In a
great rage, he seized a lance and galloped back to reduce them to
proper order; but his men, perceiving him coming, mounted their
horses and fled as fast as spurs could make them. Nevertheless, he
overtook a man at arms, named Aloyer, whom he pierced through
the thigh and unhorsed, and to many others he gave severe blows.
When he had restored order, and severely reprimanded the leaders,
he continued his march to witness the deed of arms already related.
CHAP. LXI.
THE DUKE OF BURGUNDY MARCHES FROM PONT DE ST
REMY TO LAY SIEGE TO THE TOWN OF ST RIQUIER.—HE
BREAKS UP HIS SIEGE TO COMBAT THE DAUPHINOIS,
WHO ARE ADVANCING TO THE RELIEF OF THAT TOWN.
AFTER the destruction of Pont de St Remy, the duke of Burgundy
departed for Abbeville with his army, a part of which was quartered
in the suburbs. About the end of July, he marched to St Riquier, and
fixed his quarters in the castle of la Ferté, which a little before,
together with the castle of Drugy and the suburbs, had been set on
fire. His men were quartered in other places near sir John de
Luxembourg, at the gate of St John leading toward Auxi: the lord de
Croy, some days after, was lodged near the gate of St Nicholas
toward Abbeville. At the gate of the Heronhault, leading toward
Crotoy, there was not any lodgement of men at arms, which gave
free liberty to the garrison or inhabitants to go in and out of the
town at their pleasure, on horseback or on foot.
Numerous reinforcements from the principal towns, in consequence
of his summons, now joined the duke. When the quarters had been
all marked out, the Burgundians made their approaches near to the
walls, and began severely to annoy the garrison. The duke might
have under his command, as well men at arms as archers and cross-
bows, including those sent from the towns, five or six thousand
combatants. The enemy, under the lord d'Offemont, Poton de
Santrailles, Verduysant, Mengues, and other captains in the town,
might consist of twelve or fourteen hundred men; for in addition to
those they had brought thither, sir James de Harcourt had sent them
some of his most expert soldiers; and they exerted themselves to
the utmost to resist the attacks of the Burgundians.
It would be too long and tedious, were I to attempt to enumerate all
the sallies of the garrison; but in truth, they made many in which
they gained more than they lost; and in the number, was one by
which they captured some of the duke's captains, the principal of
whom were sir Emond de Boubers, Henry l'Allemant, John de
Courcelles, John de Crevecoeur, one called Ancellet, and some other
noblemen.
In the mean time, the engines which the duke had erected broke
down the gates and walls, and even destroyed some of the houses
within the town; and those which the besieged had pointed against
the burgundian army were equally destructive, so that many lives
were lost on both sides during this siege.
Sir James de Harcourt sent frequent messengers to the lord
d'Offemont, to exhort him and his brother-captains to hold out with
courage, for that they would shortly be succoured, as he had sent
for relief from divers places in Champagne, Brie, Valois, to
Compiègne and other places attached to the interest of the dauphin,
and had earnestly besought them to assemble as large a force as
they possibly could to join him, and offer battle to the duke of
Burgundy.
In consequence of this request, the Dauphinois did assemble in force
in the neighbourhood of Compiègne, whence they were to begin
their march. The duke, however, continued the siege with vigour;
but, hearing of the intentions of the Dauphinois to force him to raise
it, and to offer him battle, he called a council to determine in this
case how he should act.
It was resolved, that the duke should break up the siege, and
advance to fight the Dauphinois before they could effect a junction
with sir James de Harcourt and the others. In conformity to this
resolution, on the 29th of August, the duke dispatched Philip de
Saveuses and the lord de Crevecoeur, at night-fall, from the camp
with six score combatants, to cross the Somme at Abbeville, whence
they were to advance into Vimeu, to inquire diligently into the state
and condition of the Dauphinois, he earnestly entreated and
commanded them to attend particularly to his orders, and to send
him as soon as possible a true statement of what the Dauphinois
were intending, adding, that his whole army should very speedily
follow them.
These two captains rode during the night to Abbeville, where having
refreshed their horses a little, they advanced into Vimeu. In the
mean time, the duke of Burgundy secretly made his preparations for
breaking up the siege by packing up his tents, baggage and stores,
and, having set fire to his camp, marched strait for Abbeville. On his
arrival there, those of his army who chose to eat or to drink were
obliged to do so on horseback; for he would not suffer any one to
dismount, as he was every moment expecting intelligence of the
enemy from Philip de Saveuses and the lord de Crevecoeur.
When they had entered Vimeu, they observed about sun-rise,
toward Oisemont, the Dauphinois in handsome array, briskly pushing
forward, and making for the ford of Blanchetaque. They were so
near, that some of the Dauphinois were taken by them; and by their
means they acquired full knowledge of their intentions. They sent
them instantly to the duke, who, as I have said, was at Abbeville,
that he might hasten his march to meet them before they could
cross the river.
The duke, on receiving this intelligence, was much rejoiced, and
immediately quitted the town, and pressed his march as much as he
could, leaving behind at Abbeville his archers and cross-bows. The
Dauphinois saw the duke's army was pursuing them, and
consequently, made all haste to gain the ford of Blanchetaque, and
cross the Somme to Sir James de Harcourt, who was waiting for
them on the opposite side near to Saint Riquier. During this time,
repeated messengers were sent to hasten the march of the duke,
who, on his side, was equally eager to come up with the enemy; and
his forces pushed forward as fast as their horses could carry them.
The Dauphinois were in the act of passing the river Somme, when,
perceiving the Burgundians, they deliberately changed their purpose,
and returned to the plain, where they drew up in battle-array, and
advanced with every appearance of giving battle to the duke,
although they were very inferior in numbers to his army. Poton de
Santrailles had joined them that night, with twelve others from St
Riquier, in order to be present at the battle.
The two parties were now advanced near enough to observe exactly
the numbers on either side; and because some of the duke's men
were behind, several heralds and poursuivants were sent to hasten
them forward.
Thus the two armies moved on for a considerable space,
approaching each other; but sir James de Harcourt who, as has been
said, was posted on the other side of the river, seeing the two
parties ready to engage, never attempted to cross the ford to the
assistance of his friends, notwithstanding he himself had sent for
them, but returned to Crotoy, whence he had come that morning.
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.
textbookfull.com