diff lisp/cl-macs.el @ 5380:919c77c567bb

Add compiler macros for #'revappend, #'nreconc. 2011-03-21 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (revappend, nreconc): Add compiler macros for these two functions. (They used to be inline, but that involves needless binding of the arguments.)
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 21 Mar 2011 12:27:07 +0000
parents a32a108ae815
children 3889ef128488
line wrap: on
line diff
--- a/lisp/cl-macs.el	Mon Mar 21 12:19:25 2011 +0000
+++ b/lisp/cl-macs.el	Mon Mar 21 12:27:07 2011 +0000
@@ -3710,6 +3710,12 @@
 (define-compiler-macro pairlis (a b &optional c)
   `(nconc (mapcar* #'cons ,a ,b) ,c))
 
+(define-compiler-macro revappend (&whole form &rest args)
+  (if (eql 3 (length form)) `(nconc (reverse ,(pop args)) ,(pop args)) form))
+
+(define-compiler-macro nreconc (&whole form &rest args)
+  (if (eql 3 (length form)) `(nconc (nreverse ,(pop args)) ,(pop args)) form))
+
 (define-compiler-macro complement (&whole form fn)
   (if (or (eq (car-safe fn) 'function) (eq (car-safe fn) 'quote))
       (cond