From: William Paul Vrotney
Subject: Re: COND as macro? (was Re: Q: where to find code for COND, LET, DO, etc.)
Date: 
Message-ID: <vrotneyDCF927.A69@netcom.com>
In article <··········@rheged.dircon.co.uk> ·····@rheged.dircon.co.uk (Simon Brooke) writes:

>
>   In article <·················@netcom.com>,
>   William Paul Vrotney <·······@netcom.com> wrote:
>   >
>   >In Common Lisp to see the implementation of a macro just use MACROEXPAND
>   >on the expression you are interested in. For example a COND expression
>   >
>   >        (macroexpand '(cond (a b) (c d)))
>   >
>   >would return something like
>   >
>   >        (IF A (PROGN B) (COND (C D)))
>
>   I am interested and surprised. I always think of IF as a macro which
>   expands to COND -- COND being after all one of the dozen or so most
>   fundamental bits of LisP. It would be mildly interesting to know which
>   implementations of CL treat COND as primitive, and which IF.
>

COND used to be a fundamental form in Lisp.  But now in Common Lisp there is
WHEN and UNLESS along with COND all making up a similar family of
conditionals all of which can be implemented with the more primitive form
IF.

Again, an implementation is free to implement COND (or any macro form) as a
special form (primitive) as long as it also provides a macro expansion for
that form.  All of the special forms (there is only a handfull of them
including IF) however must be implemented as special forms.  It is
instructive to look at the small set of special forms of Common Lisp and see
if you can come up with a simpler set.


-- 

William P. Vrotney - ·······@netcom.com