Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Format is a powerful utility in the Common Lisp standard. Format strings are written in what can be considered as a printing DSL (Domain Specific Language). However powerful that language is though, it suffers from two important limitations.

  1. It is not modifiable: only a predefined set of standard directive characters can be used and it is not possible to alter their semantics.
  2. It is hardly extensible. The only embryonic extension mechanism available, the ~/ directive, is extremely cumbersome to use. The called function must either reside in the cl-user package, or you must always use its fully qualified name in the format string, even if the corresponding code lies in the appropriate package. For instance, consider that there is a function called my-format-function in the package named Every time you want to use this function, you need to write something like
    (format t "~/" ...)

    which essentially makes the / directive unusable.

FoCus is a library designed to circumvent those limitations. It allows you to customize the format DSL by adding new directive characters or modifying the standard ones. The semantics of these directive characters is specified in a so-called format table, a concept very close to that of readtables. FoCus ultimately translates into regular format calls.

This is the FoCus user manual. FoCus also comes with a (reference)Reference Manual.

Quick Start provides a very short example in order to give an overview of what’s coming next. Usage explains in detail how to use the library.