Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z - Internet FAQ Archives

FAQ: Lisp Frequently Asked Questions 2/7 [Monthly posting]
Section - [2-17] Read-time conditionalization of code (#+ #- and *features*)

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Zip codes ]

Top Document: FAQ: Lisp Frequently Asked Questions 2/7 [Monthly posting]
Previous Document: [2-16] How can I create a stream that acts like UNIX's /dev/null (i.e., gobbles any output and immediately signals EOF on
Next Document: [2-18] What reader macro characters are used in major Lisp systems?
See reader questions & answers on this topic! - Help others by sharing your knowledge

The #+ and #- syntax provides for the read-time conditionalization of
lisp code, depending on the presence or absence of keywords on the
*features* list. The nascent Common Lisp standard does not specify
what keywords an implementation must have on its features list.
Nevertheless, most implementations have features that allow one to
distinguish the implementation from other implementations. This allows
one to write implementation-dependent code that is run only in the
relevant implementations.

Here is a list of the features to use to specify a particular Common
Lisp implementation. Unfortunately, not every vendor has a
unique keyword that distinguishes their family of implementations from
those of other vendors, nor major and minor versions of the implementation.

   :lucid                       Lucid Common Lisp
   :lcl3.0                      Lucid Common Lisp v3.0 and above
   :lcl4.0                      Lucid Common Lisp v4.0 and above
   (and :allegro :franz-inc)    Franz Allegro Common Lisp
   :excl                        Franz Allegro Common Lisp 
   :aclpc                       Franz Allegro Common Lisp\PC.
   :allegro-v3.0                Franz Allegro Common Lisp v3.0 
   :allegro-v3.1                Franz Allegro Common Lisp v3.1 
   :allegro-v4.0                Franz Allegro Common Lisp v4.0 
   :allegro-v4.1                Franz Allegro Common Lisp v4.1 
   :cmu                         CMU Common Lisp
   (and :cmu :new-compiler)     CMU Common Lisp w/Python compiler
   (and :cmu :python)           CMU Common Lisp w/Python compiler
   :cmu17                       CMU Common Lisp v17 and above
   kcl                          Kyoto Common Lisp
   akcl                         Austin KCL
   :ibcl                        Ibuki Common Lisp 
   :mcl                         Macintosh Common Lisp
   :coral                       Coral Lisp; bought by Apple to become
				MACL, then MCL
   :ccl                         Coral Common Lisp
	[Note: Harlequin LispWorks also uses :ccl]
   :ccl-1                       Coral Common Lisp v1
   :ccl-1.3                     Coral Common Lisp v1.3 and higher
   :ccl-2                       present in Macintosh Common Lisp 2.0 and higher
   :harlequin-common-lisp       Harlequin Common Lisp
   :harlequin-unix-lisp         Harlequin on Unix platforms
   :harlequin-PC-lisp           Harlequin on PC platforms
   :lispworks                   Harlequin LispWorks development environment
   :lispworks3                  major release of Harlequin LispWorks
   :lispworks3.1                major and minor release of Harlequin LispWorks
   :harlequin                   All Harlequin products. not always present?
   :clisp                       CLISP Common Lisp
   :symbolics                   Symbolics Genera
   :imach                       Symbolics Genera for Ivory architecture
   :cloe-runtime                Symbolics CLOE
   :cloe                        CLOE 3.1
   :procyon                     Procyon Common Lisp
   (and :procyon :macintosh)    Procyon Common Lisp, Macintosh version
   (and :procyon :os2)          Procyon Common Lisp, OS2 version
   :gclisp                      Golden Common Lisp
   (and dec vax common)         DEC VAXlisp
   :explorer                    TI Explorer Lisp Machine  | used
   :TI                          TI Explorer Lisp Machine  | interchangeably
   :elroy                       TI Explorer release 3 and successors
   :Xerox                       Medley (Venue's CL/InterLisp combo) to rel2.01
   :medley                      Medley releases 3.0 and up
      Use  (IL:UNIX-GETPARM "mach") and (IL:UNIX-GETPARM "arch") to
      distinguish platforms under Medley.
   :ecl                         ECoLisp
   :lispm                       Symbolics, TI, and LMI Lisp machines

   In the cases where a feature is not a keyword, it is almost always
   in the LISP package.

The draft ANSI standard defines some other useful features:

  :cltl1                Compatible with the 1st edition of Steele
  :cltl2                Compatible with the 2nd edition of Steele
  :IEEE-Floating-Point  IEEE floating point support
  :X3J13                conforms to some particular draft of the ANSI
                        CL specification 
  :draft-ANSI-CL        conforms to first full public review draft
  :ANSI-CL              conforms to ANSI CL after its adoption
  :common-lisp          language family "Common Lisp"

Other features used by some Lisps include:

  :clos                 Contains a native CLOS implementation.
  :pcl                  Contains the PCL implementation of CLOS.
  :flavors              Has an implementation of Symbolics Flavors
  :loop                 Contains the :cltl1 version of the Loop macro
  :ansi-loop            Contains the ANSI Loop macro
  :clx or :xlib         Contains CLX
  :clxr4 or :CLX-MIT-R4 Contains CLX for X11R4
  :clxr5 or :CLX-MIT-R5 Contains CLX for X11R5
  :compiler             Contains a compiler  
  :windows              MS Windows version
  :color                Color display
  :monochrome           Monochrome display
  :multiprocessing      Has multiprocessing capabilities.
  :profiler             Has a PC-monitoring based profiler.

Platform-specific features, CPU-dependent features, and
operating-system specific features are also important because they can
indicate changes between different implementations of the same lisp,
such as compiled file extensions (e.g., .sbin, .hbin, etc.).
Unfortunately, not every vendor includes such features, and the naming
conventions are inconsistent. Where there are several names for the
same feature, we've put the preferred name first. Hopefully the
vendors will begin to standardize their use of these features.
CPU-dependent features include :sparc (used in CMU CL, Lucid CL,
Harlequin, and Allegro CL), :mips (used in Allegro CL), :r2000 (used
in Allegro CL even on r4000 machines), :mc68000, and :pa (HP's
9000/800 RISC cpu).  Platform-specific features include :sun (used in
Allegro CL and Lucid), :sun4 (used in CMU CL and Allegro CL), :sgi
(used in Allegro CL), :hp300, :hp400, :hp500, :sun3, :vax, :prime,
:dec, :dec3100, :macintosh (used in Procyon but not MCL), :ibm-pc,
:ibm-rt-pc.  OS-specific features include :unix (used in CMU CL, IBCL,
and Lucid CL), :vms, :sunos (used in CMU CL), :sun-os (used in Lucid),
:sunos4.0 and :sunos4 (used in various Allegro versions independent of
the actual version of SunOS), :mach (used in CMU CL), :hpux, :ultrix,
:os2, and :svr4.


   :allegro alone doesn't suffice to distinguish Franz Allegro Common
   Lisp from Macintosh Allegro Common Lisp (an early version of
   Macintosh Common Lisp). :excl specifies that the EXCL package (a
   set of Allegro extensions to Common Lisp) is present, but this has
   since become synonymous with Franz Allegro Common Lisp.

   Thanks to Vincent Keunen for gathering the information in this list.

User Contributions:

Comment about this article, ask questions, or add new information about this topic: