Practical Common Lisp

By Peter Seibel

Lisp is thought of as an academic language, but it need not be. This is the first book that introduces Lisp as a language for the real world. Practical Common Lisp presents a thorough introduction to Common Lisp, providing you with an overall understanding of the language features and how they work.

Full Description

  • ISBN13: 978-1-59059-239-7
  • 528 Pages
  • User Level: Beginner to Advanced
  • Publication Date: April 6, 2005
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $69.99
  • eBook Price: $48.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

Lisp is often thought of as an academic language, but it need not be. This is the first book that introduces Lisp as a language for the real world.

Practical Common Lisp presents a thorough introduction to Common Lisp, providing you with an overall understanding of the language features and how they work. Over a third of the book is devoted to practical examples, such as the core of a spam filter and a web application for browsing MP3s and streaming them via the Shoutcast protocol to any standard MP3 client software (e.g., iTunes, XMMS, or WinAmp). In other "practical" chapters, author Peter Seibel demonstrates how to build a simple but flexible in-memory database, how to parse binary files, and how to build a unit test framework in 26 lines of code.

Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

Please Login to submit errata.

On page 107:
Entered the following code:

;; Unit test framework

(defun report-result (result form)
(format t "~:[FAIL~;pass~] ... ~a~%" result form)
result)

(defmacro check (&body forms)
`(combine-results
,@(loop for f in forms collect `(report-result ,f ',f))))

(defmacro combine-results (&body forms)
(with-gensyms (result)
`(let ((,result t))
,@(loop for f in forms collect `(unless ,f (setf ,result nil)))
,result)))

(defun test-+ ()
(check
(= (+ 1 2) 2)
(= (+ 1 2 3) 6)
(= (+ -1 -3) -4)))

GNU CLISP 2.49 gives the following error:


[1]> (load "test.lisp")
;; Loading file test.lisp ...
*** - LET: variable RESULT has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of RESULT.
STORE-VALUE :R2 Input a new value for RESULT.
SKIP :R3 skip (DEFUN TEST-+ NIL ...)
RETRY :R4 retry (DEFUN TEST-+ NIL ...)
STOP :R5 stop loading file /Users/chuck/lisp/cpl/9/test.lisp
ABORT :R6 Abort main loop

Been away from Lisp for a while, so I haven't been able to track down why it is failing yet.