(if (not (eq (car-safe compiler-function) 'lambda))
`(eval-and-compile
(function-put ',f 'compiler-macro #',compiler-function))
- (let ((cfname (intern (concat (symbol-name f) "--anon-cmacro"))))
+ (let ((cfname (intern (concat (symbol-name f) "--anon-cmacro")))
+ ;; Avoid cadr/cddr so we can use `compiler-macro' before
+ ;; defining cadr/cddr.
+ (data (cdr compiler-function)))
`(progn
(eval-and-compile
(function-put ',f 'compiler-macro #',cfname))
;; if needed.
:autoload-end
(eval-and-compile
- (defun ,cfname (,@(cadr compiler-function) ,@args)
- ,@(cddr compiler-function))))))))
+ (defun ,cfname (,@(car data) ,@args)
+ ,@(cdr data))))))))
(list 'doc-string
#'(lambda (f _args pos)
(list 'function-put (list 'quote f)
(lambda (&rest args2)
(apply fun (append args args2))))
+(defun zerop (number)
+ "Return t if NUMBER is zero."
+ ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
+ ;; = has a byte-code.
+ (declare (compiler-macro (lambda (_) `(= 0 ,number))))
+ (= 0 number))
+
\f
;;;; List functions.
(if (> n 0) (setcdr (nthcdr (- (1- m) n) list) nil))
list))))
-;; This function appears here instead of under the 'Basic Lisp
-;; functions' heading because during bootstrap its compiler-macro
-;; requires functions defined under the 'List functions' heading.
-(defun zerop (number)
- "Return t if NUMBER is zero."
- ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
- ;; = has a byte-code.
- (declare (compiler-macro (lambda (_) `(= 0 ,number))))
- (= 0 number))
-
(defun proper-list-p (object)
"Return OBJECT's length if it is a proper list, nil otherwise.
A proper list is neither circular nor dotted (i.e., its last cdr