4 ms·
I can't read MACLISP, but these two Common Lisp macros match the behavior that's described in the big comment: (defmacro defsmac (name params expr) `
by pdw 10y ago
I can't read MACLISP, but these two Common Lisp macros match the behavior that's described in the big comment:
(defmacro defsmac (name params expr)
`(defmacro ,name ,params
(sublis (mapcar 'cons ',params (list ,@params)) ',expr)))
(defmacro defmac (name params expr)
`(defmacro ,name ,params
(list '(lambda ,params ,expr) ,@params)))
- Animats 10y agoThanks very much. It turns out the first one can be called with multiple args in the "expr" slot, so it has to be (defmacro defsmac (name params &rest expr) `(defmacro ,name ,params `,(cons 'progn (sublis (mapcar 'cons ',params (list ,@params)) ', expr)))) but your code got me un-stuck.