Mercurial > hg > xemacs-beta
comparison lisp/cl-macs.el @ 5314:596011a8bf8f
= < > <= >=: it's OK to use the compiler macro when first, last args side effect
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (= < > <= >=):
For these functions' compiler macros, the optimisation is safe
even if the first and the last arguments have side effects, since
they're only used the once.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 29 Dec 2010 23:47:30 +0000 |
parents | 5ed261fd2bd9 |
children | 9ac28212c75a |
comparison
equal
deleted
inserted
replaced
5313:5ed261fd2bd9 | 5314:596011a8bf8f |
---|---|
3750 ;; have no side effects, transform to a series of two-argument | 3750 ;; have no side effects, transform to a series of two-argument |
3751 ;; calls. | 3751 ;; calls. |
3752 (put function 'cl-compiler-macro | 3752 (put function 'cl-compiler-macro |
3753 #'(lambda (form &rest arguments) | 3753 #'(lambda (form &rest arguments) |
3754 (if (or (null (nthcdr 3 form)) | 3754 (if (or (null (nthcdr 3 form)) |
3755 (notevery #'cl-safe-expr-p (cdr form))) | 3755 (notevery #'cl-safe-expr-p (butlast (cdr arguments)))) |
3756 form | 3756 form |
3757 (cons 'and (mapcon | 3757 (cons 'and (mapcon |
3758 #'(lambda (rest) | 3758 #'(lambda (rest) |
3759 (and (cdr rest) | 3759 (and (cdr rest) |
3760 `((,(car form) ,(pop rest) | 3760 `((,(car form) ,(pop rest) |