Common Lisp Programming Exercises
In general, you don't have to use a strict Common Lisp exercise source: a problem statement or a specification can be implemented in any programming language, including Common Lisp, even if the author of the problem had another specific programming language in mind. Of course, that means that some exercises become trivial, and other may be more difficult, so some adaptation may be needed: just take it as part of the exercise ;-)
Nevertheless, Common Lisp has specific and unique features which can only be addressed by a carefully designed set of exercises tailored to it. For example, standard exercises won't cover conditions or multiple (return) values, let alone macros.
- ANSI Common Lisp by Paul Graham seems to be the only textbook in existence coming with what resembles an exhaustive set of basic exercises. Check out annotations on this book by Chris Riesbeck as Graham's CL style is not flawless.
- Despite its title, the book Paradigms of Artificial Intelligence Programming by Peter Norvig is a very good introductory book to Common Lisp. Each chapter contains exercises and answers to them.
- Structure and Interpretation of Computer Programs has a number of exercises, similarly designed with scheme in mind, but that one can implement in Common Lisp without difficulty, such as: Solutions in CL by Eli Bendersky (only the first exercises are in CL, later he switched to scheme, but you can do everything in CL).
Probably the best sources of lisp exercises are your university courses and teachers, for example:
- Lisp Recursive Programming Exercises from York University
- Travaux dirigés de programmation Lisp from the Laboratoire de Recherche en Informatique (Bordeaux, France).
Here are some other lisp exercises sources.
Common Lisp Koans is a language learning exercise in the same vein as
the ruby koans, python koans and others. It is a port of the prior
koans with some modifications to highlight lisp-specific features
- L-99: Ninety-Nine Lisp Problems actually derived from a set of 99 prolog problems ( with CL solutions by informatimago).
- Similarly, a set of Java array exercises: 30 Java array interview questions and answers ( with CL solutions by informatiamgo).
- Excercism.io offers a Common Lisp track with 42 exercises. Each exercise comes with a unit test script.
- The blog Programming Praxis proposes regularly interesting exercises (the blog author proposes scheme solutions but solutions in any language are accepted in the comments). Repository with Solutions in Common Lisp.
Some automatic on-line programming series accept lisp submissions, or lisp produced results, including:
- Kattis Online Judge where you would submit CL programs run with sbcl. See Kattis Lisp Help.
- Sphere Online Judge where you would submit CL programs run with sbcl
- Project Euler where I'm told you only have to submit the answers, so you can use any CL implementation to compute them.
- CodeEval has many coding challenges categorized easy, moderate, hard. It doesn't accept solutions written in CL, but who cares?
There are also language agnostic programming exercises books such as:
- Exercises for Programmers – 57 Challenges to Develop Your Coding Skills by Brian P. Hogan
- 500 Data Structures and Algorithms interview questions and their solutions
A useful resource can be IDEone, a web IDE allowing you to write, compile and run little programs in various languages, including Common Lisp (sbcl or clisp).