Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!mcvax!prlb2!crcge1!kuczynsk
From: kuczynsk@crcge1.UUCP (Pascal Kuczynski)
Newsgroups: comp.lang.lisp
Subject: Re: Macros for the elementary lithp programmer
Message-ID: <1714@crcge1.UUCP>
Date: Fri, 9-Jan-87 07:00:21 EST
Article-I.D.: crcge1.1714
Posted: Fri Jan  9 07:00:21 1987
Date-Received: Sat, 10-Jan-87 01:43:51 EST
References: <4455@mit-eddie.MIT.EDU>
Reply-To: kuczynsk@crcge1.UUCP (Pascal Kuczynski)
Organization: CRCGE, Marcoussis. France
Lines: 25

In article <4455@mit-eddie.MIT.EDU> glenn@mit-eddie.UUCP writes:
>Example: (defmacro foo(&rest body))
>
>I want this form to translate to (/ body) if (oddp (car body))
>and to (* body) if	(evenp (car body)). This example is only
>to demonstrate a principle. My LISP, when given (foo 2 3 4), complains
>that '2 is a bad function.


  (defmacro foo (&rest body)
     (cons (if (oddp (car body))
             '/
	     '*)
	   body))

or more legible:
  (defmacro foo (&rest body)
     (if (oddp (car body))
       `(/ ,@body)
       `(* ,@body)))

--
   Pascal Kuczynski.
   Laboratoires de Marcoussis. Route de Nozay. Marcoussis 91460. FRANCE
 ...mcvax!inria!crcge1!kuczynsk