Appendices: Projects, Interview Questions, Cheat Sheet & Study Plan

Capstone projects, interview questions, a Common Lisp cheat sheet, Common Lisp for developers coming from other languages, and resources with a study plan.

Appendix A: Capstone Projects

Beginner: Number Guessing and Hangman Games. REPL input/output, loop, format, random numbers, string handling.

Beginner: Personal Contact Database. Plists or structures, saving and loading s-expression data files, simple queries (inspired by *Practical Common Lisp*'s CD database).

Intermediate: Text Statistics CLI. cl-ppcre and str, hash tables, clingon options, built as an executable.

Intermediate: CLOS Shape and Bank Simulators. Class hierarchies, multiple dispatch (collide), :before/:after/:around methods, custom print-object.

Intermediate: Resilient CSV Importer. Restarts (use-value, skip-row, retry) for bad rows, with policy chosen by handlers; FiveAM tests for each policy.

Intermediate: Macro DSL. A define-state-machine or HTML/SQL DSL macro with gensym hygiene and macroexpansion tests.

Advanced: REST API. Hunchentoot or Clack/Ningle + Postmodern/Mito + jzon, with authentication, a Dockerized deployment, and CI.

Advanced: Interpreter or Compiler. A Scheme or stack-language interpreter in CL, then compile it to CL code with macros for speed.

Advanced: High-Performance Numerics. A matrix or ray-tracing library with declared types, specialized arrays, lparallel parallelism, and sb-sprof profiling.

Advanced: MOP Persistence Layer. A metaclass that persists slot writes to SQLite automatically.

Systems: FFI Binding. Wrap a C library (e.g., zlib, SQLite, or raylib) with CFFI, callbacks, and an idiomatic Lisp API.

Open Source: Publish a Library. A documented ASDF system with tests, CI on SBCL and CCL, and a submission to Quicklisp/Ultralisp.

Appendix B: Interview Questions

What is Common Lisp, and how does it differ from Scheme and Clojure?

What does Lisp-2 mean? When do you need #' and funcall?

Explain nil, t, the empty list, and truthiness.

eq vs eql vs equal vs equalp vs =?

defvar vs defparameter vs defconstant? Why the *earmuffs*?

Lexical vs dynamic (special) variables: give an example.

Explain lambda list keywords: &optional, &rest, &key, &aux, &body, &whole, &environment.

What are multiple values? How do you receive them?

What is setf, and what is a "place"?

Destructive vs non-destructive list functions? Why must you use the return value of sort/delete?

Explain the loop macro's main clauses. When would you use iterate or mapcar instead?

Name the format directives you use most (~a ~s ~d ~{~} ~[~] ~%).

What are packages? What do :use, :export, :import-from, :shadow, and local nicknames do?

What is ASDF? What is Quicklisp? How do they relate?

defstruct vs defclass: when do you use each?

Explain block/return-from, catch/throw, and unwind-protect.

How do you read and write files? What does with-open-file guarantee?

What does eval-when do, and when do you need it?

Macros and CLOS What is a macro? How does it differ from a function? When should you write one?

Explain backquote, comma, and comma-at.

What is variable capture? How do gensym, with-gensyms, and once-only help?

What are reader macros? What are the risks?

What are generic functions? Why do methods belong to generic functions, not classes?

Explain multiple dispatch with an example.

Explain standard method combination (:before, :after, :around, call-next-method).

What are initialize-instance :after and print-object used for?

What is the MOP? Give a practical use case.

Conditions, Performance and Practice How does the condition system differ from exceptions in other languages?

handler-case vs handler-bind?

What are restarts? Write a function that offers use-value and skip restarts.

How do you declare types, and what does (optimize (speed 3) (safety 0)) do?

How do you profile and optimize Lisp code (time, sb-sprof, disassemble)?

How do threads interact with special variables?

How do you call C code from Lisp?

How do you build a standalone executable?

What is image-based development? What are its pros and cons?

Write flatten, group-by, and frequencies utilities.

Write a with-timing macro and a hygienic swap.

Implement a memoize function using a hash table with equal keys.

Define a CLOS hierarchy with an :around method that logs calls.

Write a function with restarts and two handlers choosing different recovery policies.

Write a word-frequency counter for a file using loop and hash tables.

Write a reader macro for vector or hash-table literals.

Optimize a numeric loop with type declarations and compare time output.

Appendix C: Common Lisp Cheat Sheet

;;; ===== Definitions =====
(defvar *x* 0) (defparameter *y* 1) (defconstant +z+ 2)
(defun f (a &optional (b 1) &rest r &key (k 0)) ...)
(defmacro m (x &body body) `(progn ,x ,@body))
(defstruct point (x 0) (y 0))
(defclass c (parent) ((s :initarg :s :initform 0 :accessor s)))
(defgeneric g (x)) (defmethod g ((x c)) ...) (defmethod g :around ((x c)) (call-next-method))
(define-condition my-error (error) ((info :initarg :info :reader info)))
(defpackage #:app (:use #:cl) (:export #:main)) (in-package #:app)

;;; ===== Binding and assignment =====
(let ((a 1) (b 2)) ...) (let* ...) (flet ((h (x) ...)) ...) (labels ...)
(setf x 1 (car l) 2 (gethash k h) 3 (aref v 0) 4) (incf x) (push x l) (pop l) (rotatef a b)

;;; ===== Control =====
(if c a b) (when c ...) (unless c ...) (cond (c1 e1) (t e2)) (case x ((:a :b) ...) (otherwise ...))
(typecase x (integer ...) (t ...)) (and ...) (or ...) (not x)
(dolist (x l) ...) (dotimes (i n) ...) (loop for x in l collect x)
(block b (return-from b v)) (catch 'tag (throw 'tag v)) (unwind-protect body cleanup)

;;; ===== Data =====
(list 1 2) (cons 1 2) (car l) (cdr l) (nth 1 l) (append a b) (reverse l) (length s)
(make-array 3 :initial-element 0) (ar
…

Appendix D: Common Lisp for Other Developers

(lambda (x) x) Call a function value (funcall f x) (defparameter *x* 1) / (let ((x 1))...) (make-hash-table), plist, alist defrecord / protocols defclass + defgeneric/defmethod Single (on self) Protocols (single), multimethods Multiple dispatch

handler-case, plus handler-bind and restarts packages + ASDF systems deps.edn / Leiningen Quicklisp / Qlot / ocicl

Mutable by default; immutable style is possible Implementation-dependent (SBCL optimizes) Decorators, reflection

Macros, reader macros, MOP, compiler macros Dynamic (+ hints) / static Dynamic (+ spec)

Dynamic + optional declarations (+ Coalton) Key gotchas:

Symbols are upcased by the reader: 'foo prints as FOO.

nil is false and the empty list; there's no separate boolean type.

Separate namespaces: use #'f to pass functions and funcall to call variables holding functions.

sort and delete are destructive; capture their return values and don't apply them to literals.

setf on an undefined variable creates an undeclared global (with a warning); always let or defvar first.

defvar won't reassign an already-defined variable when you reload a file; use defparameter when you want reassignment.

Appendix E: Resources and Study Plan

*Practical Common Lisp* (Peter Seibel): free online, the best modern introduction

*Common Lisp: A Gentle Introduction to Symbolic Computation* (David Touretzky): free, beginner-friendly *ANSI Common Lisp* (Paul Graham) *On Lisp* (Paul Graham): free; macros

*Paradigms of Artificial Intelligence Programming* (Peter Norvig): free; advanced, classic *Land of Lisp* (Conrad Barski): games

*Let Over Lambda* (Doug Hoyte): advanced macros *Common Lisp Recipes* (Edi Weitz)

*The Art of the Metaobject Protocol* (Kiczales, des Rivières, Bobrow)

*Object-Oriented Programming in Common Lisp* (Sonya Keene): CLOS

*The Common Lisp Condition System* (Michał "phoe" Herda) *Common Lisp the Language, 2nd edition* (Guy Steele): free online reference

Common Lisp HyperSpec (CLHS): the standard, online (lispworks.com/documentation/HyperSpec)

The Common Lisp Cookbook: lispcookbook.github.io Novaspec / CLCS docs, Awesome CL (github.com/CodyReichert/awesome-cl), CLiki, Quickdocs, the SBCL manual

Community: r/Common_Lisp, r/lisp, Libera.Chat #commonlisp, the Lisp Discord, European Lisp Symposium, Lisp Game Jam, Planet Lisp 13-Week Study Plan

Setup (SBCL, Quicklisp, SLIME/Sly), REPL, numbers Strings, variables (special vs lexical), conditionals, functions

Lists, alists/plists, arrays, hash tables Sequence functions, structures, symbols

Iteration, loop, closures, multiple values Non-local exits, format

Macros, advanced macros, reader macros, eval-when Packages, ASDF, Quicklisp, streams and files

CLOS: classes, generic functions, dispatch, method combination, MOP

Conditions, handlers, restarts, debugging workflows Types, performance, threads, CFFI, executables

Utilities, regex/JSON, web, databases, CLI, GUIs 50–55 + Capstone

Testing, profiling, style, deployment, Coalton, history Final tip: Live in the REPL. Compile one form at a time, let the debugger and restarts become your friends, and read the HyperSpec when in doubt. Master lists and sequences, macros, CLOS generic functions, and the condition system: together they make Common Lisp a language you can grow to fit any problem. Happy hacking! (λ)