Re: macro question
- From: Pascal Bourguignon <spam@xxxxxxxxxxxxxxxx>
- Date: Fri, 30 Sep 2005 18:41:48 +0200
"Karol Skocik" <Karol.Skocik@xxxxxxxxx> writes:
> I just can't use ,(when make-undo `(undo-funcs '())) because it leaves
> nil in the list when the condition is not true.
,@(when make-undo `((undo-funcs '())))
> How do you usually solve situations like this?
> Or did I miss something in basic macro writing rules?
This has nothing to do with macros, all with building lists. You don't
need to use backquote/comma to build lists (but it's convenient at
times). You could write:
(let ((make-undo (oddp (random 2))))
(print (list 'let (append (list (list 'x 1))
(when make-undo
(list (list 'undo-funcs '())))))))
or:
(let ((make-undo (oddp (random 2))))
(print `(let ((x 1)
,@(when make-undo
`((undo-funcs '())))))))
--
__Pascal Bourguignon__ http://www.informatimago.com/
Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.
.
- References:
- macro question
- From: Karol Skocik
- macro question
- Prev by Date: Re: lisp function questions
- Next by Date: Re: C++ and lisp and Games
- Previous by thread: macro question
- Next by thread: Re: macro question
- Index(es):