From: Luke Crook
Subject: First macro
Date: 
Message-ID: <ee7cb8ad.0401071425.41f70484@posting.google.com>
I am attempting to write a macro that generates the clauses in a COND

I do this using a mapcar..

`(cond
  ,@(mapcar #'(lambda (event) 
            (cond
               ...))
            list-of-events))

..passing it a list-of-events and having it generate the corresponding
clause..

`((eql 

..based on a (COND). My problem is that the lambda will return NIL
when no clause is generated, obviously. mapcar then cons this result
onto the result list. This tends to mess up my COND, interspersing the
tests with NIL.

Is there an easy way I can have mapcar not add NIL to the list of
results ? Or have the lambda not return a nil ? Or am I approaching
this the wrong way ?

From: Wolfhard Buß
Subject: Re: First macro
Date: 
Message-ID: <m3hdz3270x.fsf@buss-14250.user.cis.dfn.de>
MAPCLAN, a MAPCAR that doesn't cons nils, also known as MAPPEND, is
probably what you are looking for.

 (defun mapclan (function list &rest lists)
   (loop for args in (zip (cons list lists))
         when (apply function args) collect it))

-- 
"Hurry if you still want to see something. Everything is vanishing."
                                       --  Paul C�zanne (1839-1906)
From: Luke J Crook
Subject: Re: First macro
Date: 
Message-ID: <AL6Mb.54584$nG3.45585@twister.socal.rr.com>
Wolfhard Bu� wrote:
> MAPCLAN, a MAPCAR that doesn't cons nils, also known as MAPPEND, is
> probably what you are looking for.
> 
>  (defun mapclan (function list &rest lists)
>    (loop for args in (zip (cons list lists))
>          when (apply function args) collect it))
> 

Thanks for the feedback. My post is actually a dupe, thanks to the delay 
of a couple of days when I tried to post through google .

-Luke