www.delorie.com/gnu/docs/emacs/cl_64.html   search  
 
Buy the book!


Common Lisp Extensions

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

C.1 The cl-compat package

The CL package includes emulations of some features of the old `cl.el', in the form of a compatibility package cl-compat. To use it, put (require 'cl-compat) in your program.

The old package defined a number of internal routines without cl- prefixes or other annotations. Call to these routines may have crept into existing Lisp code. cl-compat provides emulations of the following internal routines: pair-with-newsyms, zip-lists, unzip-lists, reassemble-arglists, duplicate-symbols-p, safe-idiv.

Some setf forms translated into calls to internal functions that user code might call directly. The functions setnth, setnthcdr, and setelt fall in this category; they are defined by cl-compat, but the best fix is to change to use setf properly.

The cl-compat file defines the keyword functions keywordp, keyword-of, and defkeyword, which are not defined by the new CL package because the use of keywords as data is discouraged.

The build-klist mechanism for parsing keyword arguments is emulated by cl-compat; the with-keyword-args macro is not, however, and in any case it's best to change to use the more natural keyword argument processing offered by defun*.

Multiple return values are treated differently by the two Common Lisp packages. The old package's method was more compatible with true Common Lisp, though it used heuristics that caused it to report spurious multiple return values in certain cases. The cl-compat package defines a set of multiple-value macros that are compatible with the old CL package; again, they are heuristic in nature, but they are guaranteed to work in any case where the old package's macros worked. To avoid name collision with the "official" multiple-value facilities, the ones in cl-compat have capitalized names: Values, Values-list, Multiple-value-bind, etc.

The functions cl-floor, cl-ceiling, cl-truncate, and cl-round are defined by cl-compat to use the old-style multiple-value mechanism, just as they did in the old package. The newer floor* and friends return their two results in a list rather than as multiple values. Note that older versions of the old package used the unadorned names floor, ceiling, etc.; cl-compat cannot use these names because they conflict with Emacs built-ins.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003