Loving Common Lisp, or the Savvy Programmer's Secret Weapon
Loving Common Lisp, or the Savvy Programmer's Secret Weapon
About the Book
This new edition (released January 2024) of my book "Loving Common Lisp, or the Savvy Programmer's Secret Weapon" adds Large Language Model (LLM) examples and other small changes. I removed some of the older material from the earlier editions and added application examples for deep learning, back-propagation and Hopfield neural networks, using the CLML machine learning library, heuristic search, and using Common Lisp clients for: MongoDB, Solr, and relational databases. For the older 3rd edition I added a chapter using my Natural Language Processing (NLP) library and a short chapter on information gathering. For the 5th edition I added an example application for generating Knowledge Graph data (RDF and Cypher for Neo4j graph database), and hybrid examples for using Python deep learning libraires (using a web service interface).
The purpose of this book is to provide a quick introduction to Common Lisp and then provide the user with many fun and useful examples for using Common Lisp.
Before you buy this book you can first look at the programming examples at https://github.com/mark-watson/loving-common-lisp
The author has used Common Lisp professionally since 1982.
All of my Leanpub books, including this book, can be read for FREE online at https://leanpub.com/u/markwatson
Table of Contents
- Cover Material, Copyright, and License
-
Preface
- Notes on the Eighth Edition Published August 2022
- Notes on the Seventh Edition Published March 2021
- Notes on the Sixth Edition Published June 2020
- Notes on the Fifth Edition Published September 2019
- Why Use Common Lisp?
- A Request from the Author
- Older Book Editions
- Acknowledgments
- Setting Up Your Common Lisp Development System and Quicklisp
-
Introduction
- Why Did I Write this Book?
- Free Software Tools for Common Lisp Programming
- Making Book Examples Run Portably on Most Common Lisp Implementations
- How is Lisp Different from Languages like Java and C++?
- Advantages of Working in a Lisp Environment
-
Common Lisp Basics
- Getting Started with SBCL
- Making the repl Nicer using rlwrap
- The Basics of Lisp Programming
- Symbols
- Operations on Lists
- Using Arrays and Vectors
- Using Strings
- Using Hash Tables
- Using Eval to Evaluate Lisp Forms
- Using a Text Editor to Edit Lisp Source Files
- Recovering from Errors
- Garbage Collection
- Loading your Working Environment Quickly
- Functional Programming Concepts
-
Quicklisp
- Using Quicklisp to Find Packages
- Using Quicklisp to Configure Emacs and Slime
-
Defining Lisp Functions
- Using Lambda Forms
- Using Recursion
- Closures
- Using the Function eval
-
Defining Common Lisp Macros
- Example Macro
- Using the Splicing Operator
- Using macroexpand-1
-
Using Common Lisp Loop Macros
- dolist
- dotimes
- do
- Using the loop Special Form to Iterate Over Vectors or Arrays
- Common Lisp Package System
-
Input and Output
- The Lisp read and read-line Functions
- Lisp Printing Functions
-
Plotting Data
- Implementing the Library
- Packaging as a Quicklisp Project
-
Common Lisp Object System - CLOS
- Example of Using a CLOS Class
- Implementation of the HTMLstream Class
- Using Defstruct or CLOS
-
Network Programming
- An introduction to Drakma
- An introduction to Hunchentoot
- Complete REST Client Server Example Using JSON for Data Serialization
- Network Programming Wrap Up
-
Using the Brave Search APIs
- Setting an Environment Variable for the Access Key for Brave Search APIs
- Example Search Script
-
Accessing Relational Databases
- Database Wrap Up
-
Using MongoDB, Solr NoSQL Data Stores
- MongoDB
- A Common Lisp Solr Client
- NoSQL Wrapup
-
Natural Language Processing
- Loading and Running the NLP Library
- Part of Speech Tagging
- Categorizing Text
- Detecting People’s Names and Place Names
- Summarizing Text
- Text Mining
-
Information Gathering
- DBPedia Lookup Service
- Web Spiders
- Using Apache Nutch
- Wrap Up
-
Using The CL Machine-Learning Library
- Using the CLML Data Loading and Access APIs
- K-Means Clustering of Cancer Data Set
- SVM Classification of Cancer Data Set
- CLML Wrap Up
- Backpropagation Neural Networks
- Hopfield Neural Networks
-
Using Python Deep Learning Models In Common Lisp With a Web Services Interface
- Setting up the Python Web Services Used in this Chapter
- Installing the spaCY NLP Services
- Installing the Coreference NLP Services
- Common Lisp Client for the spaCy NLP Web Services
- Common Lisp Client for the Coreference NLP Web Services
- Trouble Shooting Possible Problems - Skip if this Example Works on Your System
- Python Interop Wrap-up
-
Using the PY4CL Library to Embed Python in Common Lisp
- Project Structure, Building the Python Wrapper, and Running an Example
- Implementation of spacy-py4cl
- Trouble Shooting Possible Problems - Skip if this Example Works on Your System
- Wrap-up for Using Py4CL
-
Semantic Web and Linked Data
- Resource Description Framework (RDF) Data Model
- Extending RDF with RDF Schema
- The SPARQL Query Language
- Case Study: Using SPARQL to Find Information about Board of Directors Members of Corporations and Organizations
- Installing the Apache Jena Fuseki RDF Server
- Common Lisp Client Examples for the Apache Jena Fuseki RDF Server
-
Implementing a Simple RDF Datastore and Partial SPARQL Support in Common Lisp
- 1. RDF Triple Structure
- 2. RDF Datastore
- 3. Basic Datastore Operations
- 4. Query Support
- 5. SPARQL Query Structure
- 6. SPARQL Query Parsing
- 7. Query Execution
- 8. Result Projection
- 9. Main Query Execution
- Conclusion
-
Automatically Generating Data for Knowledge Graphs
- Implementation Notes
- Generating RDF Data
- Generating Data for the Neo4j Graph Database
- Implementing the Top Level Application APIs
- Implementing The Web Interface
- Creating a Standalone Application Using SBCL
- Augmenting RDF Triples in a Knowledge Graph Using DBPedia
- KGCreator Wrap Up
- Knowledge Graph Sampler for Creating Small Custom Knowledge Graphs
-
Knowledge Graph Navigator Common Library Implementation
- Example Output
- Project Configuration and Running the Application
- Review of NLP Utilities Used in Application
- Developing Low-Level SPARQL Utilities
- Implementing the Caching Layer
- Utilities in the Main Library File kgn-common.lisp
- Wrap-up
-
Knowledge Graph Navigator Text-Based User Interface
- Example Output
- Text User Interface Implementation
- Wrap-up
-
Knowledge Graph Navigator User Interface Using LispWorks CAPI
- Project Configuration and Running the Application
- Utilities to Colorize SPARQL and Generated Output
- Main Implementation File kgn-capi-ui.lisp
- User Interface Utilites File user-interface.lisp
- User Interface CAPI Options Panes Definition File option-pane.lisp
- Using LispWorks CAPI UI Toolkit
- Wrap-up
-
Using the OpenAI and Mistral APIs
- History of OpenAI
- Common Lisp Library for Using OpenAI APIs
- History of Mistral AI
- Client Library for Mistral APIs
-
Using the Anthropic Claude LLM Completion API
- History of Anthropic and How They Differ From OpenAI
- Common Lisp Library for the Anthropic LLM Completion API
- Anthropic Text Completion API Wrapup
-
Using the Hugging Face Deep Learning Natural Language Processing APIs
- History of Hugging Face and How They Differ from OpenAI and Anthropic
- Common Lisp Library for Hugging Face APIs
- Hugging Face APIs Wrapup
-
Using a Local Document Embeddings Vector Database With OpenAI GPT3 APIs for Semantically Querying Your Own Data
- Overview of Local Embeddings Vector Database to Enhance the Use of GPT3 APIs With Local Documents
- Implementing a Local Vector Database for Document Embeddings
- Using Local Embeddings Vector Database With OpenAI GPT APIs
- Testing Local Embeddings Vector Database With OpenAI GPT APIs
- Adding Chat History
- Wrap Up for Using Local Embeddings Vector Database to Enhance the Use of GPT3 APIs With Local Documents
-
Prompt Engineering for Large Language Models
- Two Types of LLMS
- Prompt Examples
- Prompt Engineering Wrapup
- Using Common Lisp with Wolfram/One
- Using the Lem Editor
- Book Wrapup
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them