Professional Documents
Culture Documents
Instant Download Ebook of Programming Algorithms in Lisp 1St Edition Vsevolod Domkin Online Full Chapter PDF
Instant Download Ebook of Programming Algorithms in Lisp 1St Edition Vsevolod Domkin Online Full Chapter PDF
https://ebookmeta.com/product/programming-algorithms-in-lisp-
writing-efficient-programs-with-examples-in-ansi-common-lisp-1st-
edition-vsevolod-domkin/
https://ebookmeta.com/product/land-of-lisp-learn-to-program-in-
lisp-one-game-at-a-time-1st-edition-conrad-barski/
https://ebookmeta.com/product/concurrent-programming-algorithms-
principles-and-foundations-1st-edition-michel-raynal/
https://ebookmeta.com/product/options-and-derivatives-
programming-in-c23-algorithms-and-programming-techniques-for-the-
financial-industry-3rd-edition-carlos-oliveira/
Cryptography and Cryptanalysis in MATLAB: Creating and
Programming Advanced Algorithms 1st Edition Marius
Iulian Mihailescu
https://ebookmeta.com/product/cryptography-and-cryptanalysis-in-
matlab-creating-and-programming-advanced-algorithms-1st-edition-
marius-iulian-mihailescu/
https://ebookmeta.com/product/common-lisp-recipes-a-problem-
solution-approach-edmund-weitz/
https://ebookmeta.com/product/pro-cryptography-and-cryptanalysis-
with-c-20-creating-and-programming-advanced-algorithms-1st-
edition-marius-iulian-mihailescu/
https://ebookmeta.com/product/pro-cryptography-and-cryptanalysis-
with-c-20-creating-and-programming-advanced-algorithms-1st-
edition-marius-iulian-mihailescu-2/
https://ebookmeta.com/product/genetic-algorithms-in-elixir-1st-
edition-sean-moriarity/
Vsevolod Domkin
Programming Algorithms in Lisp
Writing Efficient Programs with Examples in ANSI
Common Lisp
1st ed.
Vsevolod Domkin
Kyiv, Ukraine
The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
In the book, I’ll address, primarily, the second issue but will also try
to touch on the first whenever possible.
Besides, learning the art of solving difficult algorithmic problems
trains the brain and makes it more apt to solving various other
problems, in the course of your day-to-day work.
Finally, you will be speaking the same lingua franca as other
advanced programmers—the tongue that transcends the mundane
differences of particular programming languages. And you’ll gain a
more detached view of those differences, freeing your mind from the
dictate of a particular set of choices exhibiting in any one of them.
One of the reasons for this gap of understanding of the value of
algorithms, probably, originates from how they are usually presented in
the computer science curriculum. First, it is often done in a rather
theoretical or “mathematical” way with rigorous proofs and lack of
connection to the real world. Second, the audience is usually freshmen
or sophomores who don’t have a lot of practical programming
experience and thus can’t appreciate and relate how this knowledge
may be applied to their own programming challenges (because they
didn’t have those yet)—rather, most of them are still at the level of
struggling to learn well their first programming language and, in their
understanding of computing, are very much tied to its choices and
idiosyncrasies.
In this book, the emphasis is made on the demonstration of the use
of the described data structures and algorithms in various areas of
computer programming. Moreover, I anticipate that the self-selected
audience will comprise programmers with some experience in the field.
This makes a significant difference in the set of topics that are relevant
and how they can be conveyed. Another thing that helps a lot is when
the programmer has a good command of more than one programming
language, especially if the languages are from different paradigms:
static and dynamic, object-oriented and functional. These factors allow
bridging the gap between “theoretical” algorithms and practical coding,
making the topic accessible, interesting, and inspiring.
This is one answer to a possible question: Why write another book
on algorithms? Indeed, there are several good textbooks and online
courses on the topic, of which I’d recommend the most Steven Skiena’s
The Algorithm Design Manual. Yet, as I said, this book is not at all
academic in presentation of the material, which is a norm for other
textbooks. Except for simple arithmetic, it contains almost no “math” or
proofs. And, although proper attention is devoted to algorithmic
complexity, it doesn’t deal with theories of complexity or computation
and similar scientific topics. Besides, all the algorithms and data
structures come with some example practical use cases. Last, but not
least, there’s no book on algorithms in Lisp, and, in my opinion, it’s a
great topic to introduce the language. The next chapter will provide a
crash course to grasp the basic ideas, and then we’ll discuss various
Lisp programming approaches alongside the algorithms they will be
used to implement.
This is an introductory book, not a bible of algorithms. It will draw a
comprehensive picture and cover all topics necessary for further
advancement of your algorithm knowledge. However, it won’t go too
deep into the advanced topics, such as persistent or probabilistic data
structures and advanced tree, graph, and optimization algorithms, as
well as algorithms for particular fields, such as machine learning,
cryptography, or computational geometry. All of those fields require
(and usually have) separate books of their own.
A Few Words About Lisp
For a long time, I’d been contemplating writing an introductory book on
Lisp, but something didn’t add up. I couldn’t see the coherent picture, in
my mind. And then I got a chance to teach algorithms with Lisp. From
my point of view, it’s a perfect fit for demonstrating data structures and
algorithms (with a caveat that students should be willing to learn it),
while discussing the practical aspects of those algorithms allows to
explain the language naturally. At the same time, this topic requires
almost no endeavor into the adjacent areas of programming, such as
architecture and program design, integration with other systems, user
interface, and use of advanced language features, such as types or
macros. And that is great because those topics are overkill for an
introductory text and they are also addressed nicely and in great detail
elsewhere (see Practical Common Lisp and ANSI Common Lisp).
Why Lisp is great for algorithmic programs? One reason is that the
language was created with such use case in mind. It has support for all
the proper basic data structures, such as arrays, hash-tables, linked
lists, strings, and tuples. It also has a numeric tower, which means no
overflow errors and, so, a much saner math. Next, it’s created for the
interactive development style, so the experimentation cycle is very
short, there’s no compile-wait-run-revise red tape, and there are no
unnecessary constraints, like the need for additional annotations (a.k.a.
types), prohibition of variable mutation, or other stuff like that. You just
write a function in the REPL (Read-Eval-Print Loop), run it, and see the
results. In my experience, Lisp programs look almost like pseudocode.
Compared to other languages, they may be slightly more verbose at
times but are much more clear, simple, and directly compatible with the
algorithm’s logical representation.
But why not choose a popular programming language? The short
answer is that it wouldn’t have been optimal. There are four potential
mainstream languages that could be considered for this book: C++, Java,
Python, and JavaScript (JS). (Surely, there’s already enough material on
algorithms that use them.) The first two are statically typed, which is, in
itself, a big obstacle to using them as teaching languages. Java is also too
verbose, while C++ too low level. These qualities don’t prevent them
from being used in the majority of production algorithm code, in the
wild, and you’ll, probably, end up dealing with such code sooner than
later if not already. Besides, their standard libraries provide great
examples of practical algorithm implementation. But I believe that
gaining good conceptual understanding will allow to easily adapt to one
of these languages if necessary, while learning them in parallel with
diving into algorithms creates unnecessary complexity. Python and JS
are, in many ways, the opposite choices: they are dynamic and provide
some level of an interactive experience (albeit inferior compared to
Lisp), but those languages are in many ways anti-algorithmic. Trying to
be simple and accessible, they hide too much from the programmer and
don’t give enough control of the concrete data. Teaching algorithms,
using their standard libraries, seems like cheating to me as their basic
data structures often are not what they claim to be. Lisp is in the
middle: it is both highly interactive and gives enough control of the
environment while not being too verbose and demanding. And the price
to pay—the unfamiliar syntax—is really small, in my humble opinion.
Mostly, this book will be dedicated to showing Lisp code and
explaining it. Yet, all such code snippets will fall into two quite different
categories:
One kind will represent complete code blocks (with occasional
small omissions left as exercises for you) that could be run in the Lisp
environment, accompanied with the examples of its invocation.
These code blocks are accessible in a dedicated GitHub repository.
The other kind is represented by sketches used to explain how
the presented algorithms will be built into larger systems (usually,
you’ll see these sketches in the “in action” section of each chapter).
Such sketches will not be runnable as they may require a lot of
supporting code and/or infrastructure and should be treated only as
an outline.
© Vsevolod Domkin 2021
V. Domkin, Programming Algorithms in Lisp
https://doi.org/10.1007/978-1-4842-6428-7_2
2. Algorithmic Complexity
Vsevolod Domkin1
(1) Kyiv, Ukraine
The introductory post for this book, unexpectedly, received quite a lot
of attention, which is nice since it prompted some questions, and one of
them I planned to address in this chapter.
I expect that there will be two main audiences for this book:
People who’d like to advance in algorithms and writing efficient
programs—the major group
Lispers, either accomplished or aspiring, who also happen to be
interested in algorithms
This chapter is intended primarily for the first group. After reading
it, the rest of the Lisp code from the book should become
understandable to you. Besides, you’ll know the basics to run Lisp and
experiment with it if you will so desire.
As for the lispers, you might be interested to glance over this part
just to understand my approach to utilizing the language throughout
the book.
Another random document with
no related content on Scribd:
Altertumswissenschaft.]
Wood, Athenae. Athenae Oxonienses, an Exact History of all
Writers and Bishops who have had their Education in the University
of Oxford. By Anthony à Wood. 2nd ed. by P. Bliss. 4 vols. 1813-20.
Wood, Hist. Univ. History and Antiquities of the University of
Oxford. By Anthony à Wood. Now first published in English with
continuation by J. Gutch. 2 vols. 1792-6.
Wood-Martin. Traces of the Elder Faiths of Ireland. By W. G.
Wood-Martin. 2 vols. 1902.
Wordsworth. Notes on Mediaeval Services in England, with an
index of Lincoln Ceremonies. By C. Wordsworth, 1898.
Wordsworth, Proc. Ceremonies and Processions of the
Cathedral Church of Salisbury. Edited by C. Wordsworth, 1901.
[From Salisbury Chapter MS. 148 of † 1445, a book for use by the
principalis persona in the choir, and supplementary to the printed
Processional.]
Wright. Early Mysteries and other Latin Poems of the Twelfth
and Thirteenth Centuries. By T. Wright, 1838.
Wright, Chester Plays. The Chester Plays. Edited by Thomas
Wright. 2 vols. 1843. [Shakespeare Society.]
Wright, Map. The Latin Poems commonly attributed to Walter
Mapes. Collected and edited by T. Wright, 1841. [C. S. o. s. xvii.]
Wright-Halliwell. Reliquiae Antiquae: Scraps from Ancient
Manuscripts, illustrating chiefly Early English Literature and the
English Language. By T. Wright and J. O. Halliwell. 2 vols. 1841.
Wright-Wülcker. Anglo-Saxon and Old English Vocabularies.
By T. Wright. Edited and collated by R. P. Wülcker. 2 vols. 1884.
Wülcker. Grundriss zur Geschichte der angelsächsischen
Litteratur: mit einer Übersicht der angelsächsischen
Sprachwissenschaft. Von R. Wülcker, 1885.
Wylie. A History of England under Henry IV. By J. H. Wylie. 4
vols. 1884-98.
York Breviary. Breviarium ad usum insignis Ecclesiae
Eboracensis. Edidit S. W. Lawley. 2 vols. 1880-2. [Surtees Soc. lxxi,
lxxv.]
York Manual. Manuale et Processionale ad usum insignis
Ecclesiae Eboracensis. Edidit W. G. Henderson, 1875. [Surtees Soc.
lxiii. Contains also Sarum Manual.]
York Missal. Missale ad usum insignis Ecclesiae Eboracensis.
Edidit W. G. Henderson. 2 vols. 1874. [Surtees Soc. lix, lx.]
York Plays. The Plays performed by the Crafts or Mysteries of
York on the Day of Corpus Christi. Edited by L. T. Smith, 1885.
Z. f. d. A. Zeitschrift für deutsches Alterthum [afterwards added
und deutsche Literatur], 1841-1903. [In progress.]
Z. f. rom. Phil. Zeitschrift für romanische Philologie, 1877-1903.
[In progress.]
Zschech. Die Anfänge des englischen Dramas. Von Dr.
Zschech, 1886. [Not consulted.]
BOOK I
MINSTRELSY
C’est une étrange entreprise que celle de faire rire les
honnêtes gens.—J.-B. Poquelin de Molière.
Molière est un infâme histrion.—J.-B. Bossuet.
CHAPTER I
THE FALL OF THE THEATRES