The Common Lisp Cookbook
Find a file
2025-07-24 17:49:04 +02:00
.github (minor) simplify FUNDING.yml 2020-12-17 16:19:44 +01:00
_includes incf year 2025-01-13 20:15:25 +01:00
_layouts fix: Fix wrong script tag attribute 2025-06-26 14:13:36 +02:00
assets banner and web: link to new web-apps-in-lisp 2025-01-13 20:13:42 +01:00
drafts display the defmodel macro in an html page 2019-03-01 17:51:36 +01:00
.gitignore provide detailed instructions on initial setup 2018-01-03 00:12:35 +01:00
_config.yml (minor) site: title and description++ 2024-09-01 21:06:32 +02:00
AppendixA.jpg Added files for win32.html (jdcal) 2003-03-11 05:21:55 +00:00
AppendixB.jpg Added files for win32.html (jdcal) 2003-03-11 05:21:55 +00:00
AppendixC.jpg Added files for win32.html (jdcal) 2003-03-11 05:21:55 +00:00
arrays.md fix truncated snippets for PDF 2023-12-13 13:42:16 +01:00
CHANGELOG walk directories 2019-09-18 16:40:54 +02:00
cl21.md cl21.md: typo: staling -> stalling 2024-06-13 16:01:47 -04:00
clos.md CLOS: export symbols all at once with slime-export-class 2024-02-05 12:59:04 +01:00
CONTRIBUTING.md CONTRIBUTING.md: fix markdown, remove EOL whitespace 2024-04-30 11:02:58 +02:00
contributors.md update contributors 2023-12-13 14:25:45 +01:00
dandelion.png add Dandelion, Eclipse plugin with last commit last year ! 2018-12-22 13:22:30 +01:00
data-structures.md fix: sort doesn't take a :test keyword 2025-07-16 10:53:13 +02:00
databases.md databases: in-memory SQLite 2024-11-12 19:16:05 +01:00
dates_and_times.md local-time: more formatting symbols (long and short weekday, month etc) 2023-10-16 19:48:22 +02:00
debugging.md debugging: list callers and callees 2025-01-04 10:06:35 +01:00
Dockerfile Added Dockerfile for running Jekyll 2024-02-16 16:44:58 +01:00
dynamic-libraries.md dynamic libraries: note on the team behind SBCL-Librarian 2024-04-19 12:16:37 +02:00
editor-support.md editors: mention plain-common-lisp in Emacs section 2024-12-03 16:23:55 +01:00
emacs-ide.md (minor) add two alt to img tags 2025-07-05 14:07:05 +02:00
equality.md equalp for hash-tables 2024-09-24 13:26:09 +02:00
error_handling.md (minor) disable debugger is implied by --non-interactive 2025-07-09 18:57:16 +02:00
ffi.md fixed a typo 2025-03-18 13:01:00 +01:00
files.md Minor condition system improvements 2025-01-09 20:38:59 +01:00
fix-epub-links.sed fix-epub-links.sed: minor grammar and spelling fixes 2024-04-30 11:02:58 +02:00
foreword.md add Foreword (for EPUB) 2020-12-16 23:21:09 +01:00
functions.md setf functions: only 1 mandatory argument 2025-07-18 16:56:12 +02:00
Gemfile pin Jekyll to the version used by gh-pages, add CSS for the syntax highlighting. 2020-02-25 12:10:34 +01:00
Gemfile.lock pin Jekyll to the version used by gh-pages, add CSS for the syntax highlighting. 2020-02-25 12:10:34 +01:00
getting-started.md impls: mention SICL 2025-03-03 22:43:58 +01:00
gui.md Minor condition system improvements 2025-01-09 20:38:59 +01:00
index.md release 2025-01 2025-01-09 15:49:48 +01:00
io.md (minor) i/o: need content before header and first section 2025-03-19 13:10:03 +01:00
iteration.md (minor) iteration: for over style 2025-05-05 23:30:19 +02:00
license.md (minor) licence: bump year 2022-09-14 18:39:03 +02:00
lispworks.md mention lw-plugins 2025-01-30 17:04:55 +01:00
macros.md macros: add define-symbol-macro, symbol-macrolet 2025-03-18 14:07:53 +01:00
make-cookbook.lisp Makefile: sed environment variable and granular build options 2025-07-24 17:49:04 +02:00
Makefile Makefile: sed environment variable and granular build options 2025-07-24 17:49:04 +02:00
manifest.scm Adds guix manifest 2022-01-26 14:17:12 +01:00
metadata.txt release 2025-01 2025-01-09 15:49:48 +01:00
misc.md Fix a typo 2018-06-19 11:57:00 +05:30
numbers.md Minor condition system improvements 2025-01-09 20:38:59 +01:00
numbertower.png numbers: include the Number Tower 2024-06-27 14:25:32 +02:00
orly-cover.png rm contributors from index, add O'Rly cover 2019-05-19 15:39:27 +02:00
os.md os: mention shell or not shell, better structure :output options 2025-03-13 15:02:13 +01:00
packages.md package: local nicknames first, discourage global ones 2023-12-13 10:32:40 +01:00
pattern_matching.md pattern matching: match against values, elegant fib 2025-03-20 10:32:02 +01:00
performance.md performance: mention CMUCL "advanced compiler use and efficiency" guide 2024-09-24 13:26:31 +02:00
process.md fix truncated snippets for PDF 2023-12-13 13:42:16 +01:00
README.md Makefile: sed environment variable and granular build options 2025-07-24 17:49:04 +02:00
regexp.md regexp: add new count-matches (use ppcre prefix) 2024-05-02 15:55:05 +02:00
scripting.md (minor) scripting shorter subtitles 2025-01-14 16:55:41 +01:00
simple-restarts.png Error and condition handling 2017-12-21 17:01:24 +01:00
sockets.md fix truncated snippets for PDF 2023-12-13 14:25:45 +01:00
strings.md Update strings.md - thinko fix, minor additional example 2025-03-27 09:39:33 +01:00
STYLEGUIDE.md style: snippets without "cl-user" or "*" prompt 2024-10-28 20:07:43 +01:00
systems.md systems: refer to how to load an existing project 2023-10-04 18:58:19 +02:00
testing.md FIXED dead link to mockingbird 2025-05-28 19:44:16 +02:00
trace-dialog.png debugging: interactive trace dialog 2024-02-13 15:05:20 +01:00
type.md Minor condition system improvements 2025-01-09 20:38:59 +01:00
vscode-alive.md fix truncated snippets for PDF 2023-12-13 13:42:16 +01:00
web-scraping.md Minor condition system improvements 2025-01-09 20:38:59 +01:00
web.md (minor) add two alt to img tags 2025-07-05 14:07:05 +02:00
websockets.md (minor) shorter code snippets for PDF 2023-12-31 10:51:22 +01:00
win32.md Correct after-period spacing and Type Systems link (#420) 2021-12-06 18:58:22 +01:00
windows.md emacs on windows: cleanup old file 2021-01-06 00:17:13 +01:00

Lisp Cookbook

A Cookbook is an invaluable resource, as it shows how to do various things in a clear fashion without all the theoretical context. Sometimes you just need to look things up. While cookbooks can never replace proper documentation such as the HyperSpec or books such as Practical Common Lisp, every language deserves a good cookbook, Common Lisp included.

The CL Cookbook aims to tackle all sort of topics, for the beginner as for the more advanced developer.

Contributing

Thanks for contributing to the Cookbook.

You can start by having a look at the style guide.

When adding new content, please ensure it renders properly.

There are three ways to do this:

Install Jekyll system-wide

The first option is to install Jekyll globally and to run jekyll serve in a folder where this repository was checked out.

Then open http://127.0.0.1:4000/cl-cookbook/ (the last / is important).

Install system locally using Ruby gems

Another option is to install the Jekyll version of this repository locally with Ruby gems. Since bundler 1.17.3 requires Ruby 2.5 that is rather old, it is recommended to install it using rbenv:

  1. Install rbenv using your package manager, or follow these instructions to install it manually.
  2. Install ruby-build. If you did a manual installation in the previous step, it is recommended to install ruby-build as a rbenv plugin.
  3. Run rbenv install 2.5.0 to install Ruby 2.5.0. Run which gem to make sure it points to ~/.rbenv/shims/gem.
  4. Run gem install bundler -v 2.1.4 to install bundler.
  5. cd to the cl-cookbook directory and run bundle install --path vendor/bundle to install Jekyll locally.
  6. Run bundle exec jekyll serve to generate the site and host it.

Use a Docker container

Since it can be a bit troublesome to install older versions of Ruby onto newer Linux-based systems, another option is to use docker.

  1. Build the container by executing sudo docker build -t cl-cookbook . in this directory.
  2. Run Jekyll inside the container sudo docker run -p 4000:4000 -v $(pwd):/cl-cookbook cl-cookbook from this directory.
  3. Open your web browser and navigate to http://127.0.0.1:4000/cl-cookbook/.

This command will mount the current working directory into the container and incremental builds are actived so you will be able to see your latest changes without restarting or rebuilding the container.

Troubleshooting

It can happen that you have older version of ruby installed in the system and bundler install will fail. To fix this, you need to update ruby. If system update is not an option, consider installing rbenv.

    # Check rbenv homepage for install instructions on systems other than Mac OS X
    brew install rbenv ruby-build

    # Add rbenv to bash so that it loads every time you open a terminal
    echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
    source ~/.bash_profile

    # Install Ruby
    rbenv install 2.5.0
    rbenv global 2.5.0
    ruby -v

After this you can proceed as usual:

  1. gem install bundler
  2. bundle install --path vendor/bundle
  3. bundle exec jekyll serve

Also, refer to the CONTRIBUTING.md file.

Building the EPUB and the PDF

Run make epub to only build epub. Run make epub+pdf to also build pdf. See make-cookbook.lisp.

You need a decently recent version of Calibre. They provide an easy binary installation.

To exclude regions of text from the output (for example, embedded videos that makes no sense in a print format), use these flags:

<!-- epub-exclude-start -->
<!-- epub-exclude-end -->

Our build script roughly does the following:

  • concatenate all markdown content into one file
  • change yaml frontmatters to a markdown title
  • delete the mark regions from the file
  • make internal links work on the EPUB.

It uses some metadata in metadata.txt.

We can check the resulting EPUB with epubcheck.

Troubleshooting build on macOS

If you encounter the following error:

debugger invoked on a UIOP/RUN-PROGRAM:SUBPROCESS-ERROR in thread
#<THREAD tid=259 "main thread" RUNNING {1203FA81D3}>:
  Subprocess with command "sed -i \"s/title:/# /g\" full.md"
 exited with error code 1

It means that your sed program is non-GNU. Install GNU version using homebrew:

brew install gnu-sed

Now you have gsed in your PATH, you can build the book with the following command:

SED_CMD=gsed make epub

Origins

This is a fork of the Common Lisp Cookbook, moved from SourceForge.

This project brings the Common Lisp Cookbook to this decade. Development of the original Common Lisp Cookbook in SourceForge halted in 2007. In the meantime, a lot has happened in the land of Common Lisp. Tools and implementations have been improving, and some have fallen out of favor. Most notably, Common Lisp users can now benefit from the Quicklisp library manager.

The main goal is making the Cookbook more modern and more accessible in addition to updating and expanding the content.

Development with GNU Guix

To enter a development environment in which all the required software dependencies are made available, run guix shell in the project's root directory. The provided Guix manifest file will be automatically sourced after giving authorization for Guix to do so.

Support

You can support the individuals that constantly improve the Cookbook. See the Github Sponsors icon. Thanks for them!