[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Is it possible for a macro to expand to nothing?
From: |
Drew Adams |
Subject: |
RE: Is it possible for a macro to expand to nothing? |
Date: |
Mon, 23 Nov 2009 10:51:20 -0800 |
> >> you can do that by producing nil and then using ,@ inside a
> >> backquote. IOW, instead of inserting nil, you splice it in,
> >> which means inserting nothing.
> That wouldn't work, backquote is a quote.
Sorry, but it works just fine. I do this all the time.
You snipped out the code I suggested. Here it is again, with `and' substituted
for `ifdef' (which is undefined).
(defmacro titi (fn)
`(defun ,fn ()
(setq bar 1)
,@(and baz '((setq bar 2)))))
(let ((baz nil)) (titi foo))
(symbol-function 'foo) -> (lambda nil (setq bar 1))
(let ((baz t)) (titi foo))
(symbol-function 'foo) ->
(lambda nil
(setq bar 1)
(setq bar 2))
That looks to me like just what Alan asked for.
- Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/23
- RE: Is it possible for a macro to expand to nothing?, Drew Adams, 2009/11/23
- Message not available
- Re: Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/23
- RE: Is it possible for a macro to expand to nothing?, Drew Adams, 2009/11/23
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/23
- RE: Is it possible for a macro to expand to nothing?,
Drew Adams <=
- Message not available
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/23
- Re: Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/23
- RE: Is it possible for a macro to expand to nothing?, Drew Adams, 2009/11/23
- Message not available
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/23
- Re: Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/23
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/24
- Re: Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/24
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/24
- Re: Is it possible for a macro to expand to nothing?, Alan Mackenzie, 2009/11/24
- Re: Is it possible for a macro to expand to nothing?, Pascal J. Bourguignon, 2009/11/24