[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SYMBOL-MACROFLET
- To: KMP@STONY-BROOK.SCRC.Symbolics.COM
- Subject: SYMBOL-MACROFLET
- From: Eric Benson <eb@lucid.com>
- Date: Tue, 13 Sep 88 12:12:45 pdt
- Cc: KMP@STONY-BROOK.SCRC.Symbolics.COM, Moon@STONY-BROOK.SCRC.Symbolics.COM, jeff%aiai.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK, Masinter.pa@xerox.com, cl-cleanup@SAIL.STANFORD.EDU
- In-reply-to: Kent M Pitman's message of Tue, 13 Sep 88 15:05 EDT <880913150548.2.KMP@GRYPHON.SCRC.Symbolics.COM>
Date: Tue, 13 Sep 88 15:05 EDT
From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
Date: Tue, 13 Sep 88 11:27:10 pdt
From: Eric Benson <eb@lucid.com>
Doesn't this do what you want?
(defmacro fsymbolf-fmacrofletf (renamings &body body)
`(macrolet ,(mapcar #'(lambda (renaming)
`(,(first renaming) (&rest args)
`(,',(second renaming) ,@args)))
renamings)
,@body))
No: think about #' .
In my experience, a common reason to use DEFUN-IN-FLAVOR (rather than
DEFMETHOD) is to make the name suitable for MAPCAR. That is, to be
able to do (MAPCAR #'local-function things) rather than
(MAPCAR #'method-name (CIRCULAR-LIST SELF) things).
Sorry about the premature posting; my fingers slipped.
This will work:
(defmacro fsymbolf-fmacrofletf (renamings &body body)
`(flet ,(mapcar #'(lambda (renaming)
`(,(first renaming) (&rest args)
(apply #',(second renaming) args)))
renamings)
(declare (inline ,@(mapcar #'first renamings)))
,@body))
Of course you won't be happy with the result unless your compiler
optimizes (APPLY x (LIST a b c)) into (FUNCALL x a b c).