home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.lisp
- Subject: Re: Help: apply for macros ???
- Date: 19 Nov 1992 21:17:51 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 23
- Message-ID: <1eh09vINNkc7@early-bird.think.com>
- References: <2610@bigfoot.first.gmd.de>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <2610@bigfoot.first.gmd.de> wolf@prosun.first.gmd.de (Wolfgang Koehler) writes:
- >Does there exist a similiar solution if "f" is a macro ???
-
- Since macros are source-to-source transformations, this generally doesn't
- make sense to do. If you wrote a function as a macro simply to speed it
- up, you should use an inline function rather than a macro.
-
- But if you really want to do it, you could write something kludgey like:
-
- (defun g (&rest args)
- (eval `(f ,@args)))
-
- Note that if the macro expansion results in any of its arguments being
- evaluted, they'll be evaluated twice: once as part of the call to G and
- later when the macroexpansion of F is executed.
-
- Note: I'm *not* advocating this code, I think it's gross. But if you have
- a macro without a functional counterpart, you sometimes need to do it.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-