ADRE@gec-m.rutherford.ac.UK (Tony Anderdson) (10/19/87)
For the attention of : Anybody At present I am converting a program from Interlisp-D to Common lisp. The program uses a macro to define NLAMBDA functions, which are not supported in Common lisp. A solution to the NLAMBDA problem is to create a macro of the function name which places the data in a list and then calls the function, which is now under a different name. This works, however, when the macro tries to define the calling macro I have a problem. The calling macro requires a quote comma before the variable so that it is evaluated but this causes an error as the comma is outside the scope of a back quote. My original code is :- (PUTPROPS DFEXPR MACRO (LIST (BQUOTE (LET (NAME) (SETQ NAME (DEFINEQ (, (CAR LIST) (NLAMBDA , (CAADR LIST) ,@ (CDDR LIST))))) (CAR NAME) ) The Common lisp macro should define a calling macro like :- (defmacro function-name (&rest list) `(function-name-with-bit-added ',list)) NOTE : The "`" symbol above is the back quote symbol. NOTE : The comma after the "'" and before "list" in the above defmacro is the comma I am having problems with. Can anybody give advice or help with a Common lisp version. Richard Relf Admiralty Research Establishment Portland Dorset UK
cutting.pa@XEROX.COM (10/19/87)
(defmacro dfexpr (name arglist &body body) (let ((%name (gensym (string name)))) `(prog1 (defmacro ,name ,arglist (list ',%name ,@(mapcar #'(lambda (arg) `(list 'quote ,arg)) arglist))) (defun ,%name ,arglist ,@body)))) Note that this won't work if the arglist contains keywords (eg. &rest). In XCL you'd probably want to use: (defdefiner dfexpr il:functions (name arglist &body body) (let ...))