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 reference manual, and as such, it is not meant to be read. It may help you find sleep in case of insomnia though. See See (user)The FoCus User Manual, for a more human-readable guide to using FoCus.