Chapter 11. Printing Text with the format Function

Even in this modern era of programming, it’s extremely important to be able to manipulate text, and Common Lisp has some of the fanciest text-printing functions available. Whether you need to manipulate XML, HTML, Linux configuration files, or any other data in a textual format, Lisp will make your work easy.

The most important advanced text printing function in Common Lisp is the format function, which is the subject of this chapter.

Anatomy of the format Function

Here is an example of the format function in use:

> (format t "Add onion rings for only ˜$ dollars more!" 1.5)
Add onion rings for only 1.50 dollars more!

Let’s take a look at what each part of this function means.

The Destination Parameter ...

Get Land of Lisp now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.