Exercises

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.

Lisp Books:

  • 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:

Here are some other lisp exercises sources.

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:

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).