macro question
- From: "Karol Skocik" <Karol.Skocik@xxxxxxxxx>
- Date: 30 Sep 2005 09:06:36 -0700
Hello,
I need help with macro style. I sometimes need a macro which outputs
some code, but depending on some variable, I need to add something to
the output or nothing, to be more specific :
I want in a macro to have in let section something like :
`(let ((added-nodes (make-hash-table)))
....
or, sometimes I need this :
`(let ((added-nodes (make-hash-table))
(undo-funcs '()))
...
until now, I have found out that I can only make it happen when I make
the decision before defining `(let ..) and then I need to duplicate
code like this :
(if make-undo
`(let ((added-nodes (make-hash-table))
(undo-funcs '())) ...
`(let ((added-nodes (make-hash-table))) ...
and that is ugly. or maybe make a list like 'result-form' and append
stuff to that?
I just can't use ,(when make-undo `(undo-funcs '())) because it leaves
nil in the list when the condition is not true.
How do you usually solve situations like this?
Or did I miss something in basic macro writing rules?
Thank you,
Karol
.
- Follow-Ups:
- Re: macro question
- From: Alan Crowe
- Re: macro question
- From: josephoswaldgg@xxxxxxxxxxx
- Re: macro question
- From: Peter Seibel
- Re: macro question
- From: Pascal Bourguignon
- Re: macro question
- Prev by Date: Re: Where to look for the API documentation?
- Next by Date: Re: lisp function questions
- Previous by thread: Beginner - Function Critique
- Next by thread: Re: macro question
- Index(es):
Relevant Pages
|