Why are standard macros so complicated
Posted: Fri May 02, 2014 7:04 am
I'm new at this forum and have a question about the standard macros in common lisp.
When I macroexpand them, they include more let/let* than necessary and many functions, macros or tags (in tagbodys) I would normally not use. ('dolist in sbcl for example contains a truly-the macro)
If I define my own 'dolist macro I would write something like this:
If I check the time of my own macro, it is normally faster than the inbuilt 'dolist macro. Why doesn't sbcl (or clisp etc.) implement it the same way?
When I macroexpand them, they include more let/let* than necessary and many functions, macros or tags (in tagbodys) I would normally not use. ('dolist in sbcl for example contains a truly-the macro)
If I define my own 'dolist macro I would write something like this:
Code: Select all
(defmacro my-dolist (list &body body)
(let ((x (car list)) (list (cadr list)))
`(let ((,x nil) (list ,list))
(tagbody
start
(setq ,x (car list))
(setq list (cdr list))
,@body
(if list (go start))))))