-;;; cl-macs.el --- Common Lisp extensions for GNU Emacs Lisp (part four)
+;;; cl-macs.el --- Common Lisp macros -*-byte-compile-dynamic: t;-*-
;; Copyright (C) 1993 Free Software Foundation, Inc.
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; This package was written by Dave Gillespie; it is a complete
;; rewrite of Cesar Quiroz's original cl.el package of December 1986.
;;
-;; This package works with Emacs 18, Emacs 19, and Lucid Emacs 19.
-;;
;; Bug reports, comments, and suggestions are welcome!
;; This file contains the portions of the Common Lisp extensions
(put 'cl-pop 'edebug-form-spec 'edebug-sexps)
(put 'cl-pop2 'edebug-form-spec 'edebug-sexps)
-(defvar cl-emacs-type)
(defvar cl-optimize-safety)
(defvar cl-optimize-speed)
(require
(progn
- (or (fboundp 'defalias) (fset 'defalias 'fset))
(or (fboundp 'cl-transform-function-property)
(defalias 'cl-transform-function-property
(function (lambda (n p f)
(defvar cl-old-bc-file-form nil)
-;; Patch broken Emacs 18 compiler (re top-level macros).
-;; Emacs 19 compiler doesn't need this patch.
-;; Also, undo broken definition of `eql' that uses same bytecode as `eq'.
(defun cl-compile-time-init ()
- (setq cl-old-bc-file-form (symbol-function 'byte-compile-file-form))
- (or (fboundp 'byte-compile-flush-pending) ; Emacs 19 compiler?
- (defalias 'byte-compile-file-form
- (function
- (lambda (form)
- (setq form (macroexpand form byte-compile-macro-environment))
- (if (eq (car-safe form) 'progn)
- (cons 'progn (mapcar 'byte-compile-file-form (cdr form)))
- (funcall cl-old-bc-file-form form))))))
- (put 'eql 'byte-compile 'cl-byte-compile-compiler-macro)
(run-hooks 'cl-hack-bytecomp-hook))
(if (car res) (list 'progn (car res) form) form)))
(defmacro function* (func)
- "(function* SYMBOL-OR-LAMBDA): introduce a function.
+ "Introduce a function.
Like normal `function', except that if argument is a lambda form, its
ARGLIST allows full Common Lisp conventions."
(if (eq (car-safe func) 'lambda)
'quote
(list nil (cl-const-expr-val def)))
(list 'list nil def))))))))
- (cl-push karg keys)
- (if (= (aref (symbol-name karg) 0) ?:)
- (progn (set karg karg)
- (cl-push (list 'setq karg (list 'quote karg))
- bind-inits)))))))
+ (cl-push karg keys)))))
(setq keys (nreverse keys))
(or (and (eq (car args) '&allow-other-keys) (cl-pop args))
(null keys) (= safety 0)
If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level."
(if (and (fboundp 'cl-compiling-file) (cl-compiling-file)
(not cl-not-toplevel) (not (boundp 'for-effect))) ; horrible kludge
- (let ((comp (or (memq 'compile when) (memq ':compile-toplevel when)))
+ (let ((comp (or (memq 'compile when) (memq :compile-toplevel when)))
(cl-not-toplevel t))
- (if (or (memq 'load when) (memq ':load-toplevel when))
+ (if (or (memq 'load when) (memq :load-toplevel when))
(if comp (cons 'progn (mapcar 'cl-compile-time-too body))
(list* 'if nil nil body))
(progn (if comp (eval (cons 'progn body))) nil)))
- (and (or (memq 'eval when) (memq ':execute when))
+ (and (or (memq 'eval when) (memq :execute when))
(cons 'progn body))))
(defun cl-compile-time-too (form)
(cons 'progn (mapcar 'cl-compile-time-too (cdr form))))
((eq (car-safe form) 'eval-when)
(let ((when (nth 1 form)))
- (if (or (memq 'eval when) (memq ':execute when))
+ (if (or (memq 'eval when) (memq :execute when))
(list* 'eval-when (cons 'compile when) (cddr form))
form)))
(t (eval form) form)))
-(or (and (fboundp 'eval-when-compile)
- (not (eq (car-safe (symbol-function 'eval-when-compile)) 'autoload)))
- (eval '(defmacro eval-when-compile (&rest body)
- "Like `progn', but evaluates the body at compile time.
-The result of the body appears to the compiler as a quoted constant."
- (list 'quote (eval (cons 'progn body))))))
-
(defmacro load-time-value (form &optional read-only)
"Like `progn', but evaluates the body at load time.
The result of the body appears to the compiler as a quoted constant."
;;; Conditional control structures.
(defmacro case (expr &rest clauses)
- "(case EXPR CLAUSES...): evals EXPR, chooses from CLAUSES on that value.
+ "Eval EXPR and choose from CLAUSES on that value.
Each clause looks like (KEYLIST BODY...). EXPR is evaluated and compared
against each key in each KEYLIST; the corresponding BODY is evaluated.
If no clause succeeds, case returns nil. A single atom may be used in
(list 'let (list (list temp expr)) body))))
(defmacro ecase (expr &rest clauses)
- "(ecase EXPR CLAUSES...): like `case', but error if no case fits.
+ "Like `case', but error if no case fits.
`otherwise'-clauses are not allowed."
(list* 'case expr (append clauses '((ecase-error-flag)))))
(defmacro typecase (expr &rest clauses)
- "(typecase EXPR CLAUSES...): evals EXPR, chooses from CLAUSES on that value.
+ "Evals EXPR, chooses from CLAUSES on that value.
Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it
satisfies TYPE, the corresponding BODY is evaluated. If no clause succeeds,
typecase returns nil. A TYPE of `t' or `otherwise' is allowed only in the
(list 'let (list (list temp expr)) body))))
(defmacro etypecase (expr &rest clauses)
- "(etypecase EXPR CLAUSES...): like `typecase', but error if no case fits.
+ "Like `typecase', but error if no case fits.
`otherwise'-clauses are not allowed."
(list* 'typecase expr (append clauses '((ecase-error-flag)))))
;;; Blocks and exits.
(defmacro block (name &rest body)
- "(block NAME BODY...): define a lexically-scoped block named NAME.
+ "Define a lexically-scoped block named NAME.
NAME may be any symbol. Code inside the BODY forms can call `return-from'
to jump prematurely out of the block. This differs from `catch' and `throw'
in two respects: First, the NAME is an unevaluated symbol rather than a
(if cl-found (setcdr cl-found t)))
(byte-compile-normal-call (cons 'throw (cdr cl-form))))
-(defmacro return (&optional res)
- "(return [RESULT]): return from the block named nil.
+(defmacro return (&optional result)
+ "Return from the block named nil.
This is equivalent to `(return-from nil RESULT)'."
- (list 'return-from nil res))
+ (list 'return-from nil result))
-(defmacro return-from (name &optional res)
- "(return-from NAME [RESULT]): return from the block named NAME.
+(defmacro return-from (name &optional result)
+ "Return from the block named NAME.
This jump out to the innermost enclosing `(block NAME ...)' form,
returning RESULT from that form (or nil if RESULT is omitted).
This is compatible with Common Lisp, but note that `defun' and
`defmacro' do not create implicit blocks as they do in Common Lisp."
(let ((name2 (intern (format "--cl-block-%s--" name))))
- (list 'cl-block-throw (list 'quote name2) res)))
+ (list 'cl-block-throw (list 'quote name2) result)))
;;; The "loop" macro.
((memq word '(frame frames screen screens))
(let ((temp (gensym)))
- (cl-push (list var (if (eq cl-emacs-type 'lucid)
- '(selected-screen) '(selected-frame)))
+ (cl-push (list var '(selected-frame))
loop-for-bindings)
(cl-push (list temp nil) loop-for-bindings)
(cl-push (list 'prog1 (list 'not (list 'eq var temp))
(list 'or temp (list 'setq temp var)))
loop-body)
- (cl-push (list var (list (if (eq cl-emacs-type 'lucid)
- 'next-screen 'next-frame) var))
+ (cl-push (list var (list 'next-frame var))
loop-for-steps)))
((memq word '(window windows))
(let ((scr (and (memq (car args) '(in of)) (cl-pop2 args)))
(temp (gensym)))
(cl-push (list var (if scr
- (list (if (eq cl-emacs-type 'lucid)
- 'screen-selected-window
- 'frame-selected-window) scr)
+ (list 'frame-selected-window scr)
'(selected-window)))
loop-for-bindings)
(cl-push (list temp nil) loop-for-bindings)
(cl-push (list (list temp (cl-pop args))) loop-bindings)
(cl-push (list '>= (list 'setq temp (list '1- temp)) 0) loop-body)))
- ((eq word 'collect)
+ ((memq word '(collect collecting))
(let ((what (cl-pop args))
(var (cl-loop-handle-accum nil 'nreverse)))
(if (eq var loop-accum-var)
;;; Binding control structures.
(defmacro progv (symbols values &rest body)
- "(progv SYMBOLS VALUES BODY...): bind SYMBOLS to VALUES dynamically in BODY.
+ "Bind SYMBOLS to VALUES dynamically in BODY.
The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists.
Each SYMBOL in the first list is bound to the corresponding VALUE in the
second list (or made unbound if VALUES is shorter than SYMBOLS); then the
(mapcar
(function
(lambda (x)
+ (if (or (and (fboundp (car x))
+ (eq (car-safe (symbol-function (car x))) 'macro))
+ (cdr (assq (car x) cl-macro-environment)))
+ (error "Use `labels', not `flet', to rebind macro names"))
(let ((func (list 'function*
(list 'lambda (cadr x)
(list* 'block (car x) (cddr x))))))
bindings)
body))
-(defmacro labels (&rest args) (cons 'flet args))
+(defmacro labels (bindings &rest body)
+ "(labels ((FUNC ARGLIST BODY...) ...) FORM...): make temporary func bindings.
+This is like `flet', except the bindings are lexical instead of dynamic.
+Unlike `flet', this macro is fully complaint with the Common Lisp standard."
+ (let ((vars nil) (sets nil) (cl-macro-environment cl-macro-environment))
+ (while bindings
+ (let ((var (gensym)))
+ (cl-push var vars)
+ (cl-push (list 'function* (cons 'lambda (cdar bindings))) sets)
+ (cl-push var sets)
+ (cl-push (list (car (cl-pop bindings)) 'lambda '(&rest cl-labels-args)
+ (list 'list* '(quote funcall) (list 'quote var)
+ 'cl-labels-args))
+ cl-macro-environment)))
+ (cl-macroexpand-all (list* 'lexical-let vars (cons (cons 'setq sets) body))
+ cl-macro-environment)))
;; The following ought to have a better definition for use with newer
;; byte compilers.
(defvar cl-closure-vars nil)
(defmacro lexical-let (bindings &rest body)
- "(lexical-let BINDINGS BODY...): like `let', but lexically scoped.
+ "Like `let', but lexically scoped.
The main visible difference is that lambdas inside BODY will create
lexical closures as in Common Lisp."
(let* ((cl-closure-vars cl-closure-vars)
(or (consp x) (setq x (list x)))
(cl-push (gensym (format "--%s--" (car x)))
cl-closure-vars)
+ (set (car cl-closure-vars) [bad-lexical-ref])
(list (car x) (cadr x) (car cl-closure-vars))))
bindings))
(ebody
ebody))))
(defmacro lexical-let* (bindings &rest body)
- "(lexical-let* BINDINGS BODY...): like `let*', but lexically scoped.
+ "Like `let*', but lexically scoped.
The main visible difference is that lambdas inside BODY will create
lexical closures as in Common Lisp."
(if (null bindings) (cons 'progn body)
(cl-pop body))))
(list (cl-transform-function-property
func 'setf-method (cons args body)))))
+(defalias 'define-setf-expander 'define-setf-method)
(defmacro defsetf (func arg1 &rest args)
"(defsetf NAME FUNC): define a `setf' method.
(defsetf aref aset)
(defsetf car setcar)
(defsetf cdr setcdr)
+(defsetf caar (x) (val) (list 'setcar (list 'car x) val))
+(defsetf cadr (x) (val) (list 'setcar (list 'cdr x) val))
+(defsetf cdar (x) (val) (list 'setcdr (list 'car x) val))
+(defsetf cddr (x) (val) (list 'setcdr (list 'cdr x) val))
(defsetf elt (seq n) (store)
(list 'if (list 'listp seq) (list 'setcar (list 'nthcdr n seq) store)
(list 'aset seq n store)))
(defsetf gethash (x h &optional d) (store) (list 'cl-puthash x store h))
(defsetf nth (n x) (store) (list 'setcar (list 'nthcdr n x) store))
(defsetf subseq (seq start &optional end) (new)
- (list 'progn (list 'replace seq new ':start1 start ':end1 end) new))
+ (list 'progn (list 'replace seq new :start1 start :end1 end) new))
(defsetf symbol-function fset)
(defsetf symbol-plist setplist)
(defsetf symbol-value set)
;;; Some more Emacs-related place types.
(defsetf buffer-file-name set-visited-file-name t)
-(defsetf buffer-modified-p set-buffer-modified-p t)
+(defsetf buffer-modified-p (&optional buf) (flag)
+ (list 'with-current-buffer buf
+ (list 'set-buffer-modified-p flag)))
(defsetf buffer-name rename-buffer t)
(defsetf buffer-string () (store)
(list 'progn '(erase-buffer) (list 'insert store)))
(defsetf frame-parameters modify-frame-parameters t)
(defsetf frame-visible-p cl-set-frame-visible-p)
(defsetf frame-width set-screen-width t)
+(defsetf frame-parameter set-frame-parameter)
(defsetf getenv setenv t)
(defsetf get-register set-register)
(defsetf global-key-binding global-set-key)
(defsetf mark set-mark t)
(defsetf mark-marker set-mark t)
(defsetf marker-position set-marker t)
-(defsetf match-data store-match-data t)
+(defsetf match-data set-match-data t)
(defsetf mouse-position (scr) (store)
(list 'set-mouse-position scr (list 'car store) (list 'cadr store)
(list 'cddr store)))
(cl-setf-do-store (nth 1 method) (list 'cdr temp)))))))
(defmacro remf (place tag)
- "(remf PLACE TAG): remove TAG from property list PLACE.
+ "Remove TAG from property list PLACE.
PLACE may be a symbol, or any generalized variable allowed by `setf'.
The form returns true if TAG was found and removed, nil otherwise."
(let* ((method (cl-setf-do-modify place t))
"(shiftf PLACE PLACE... VAL): shift left among PLACEs.
Example: (shiftf A B C) sets A to B, B to C, and returns the old A.
Each PLACE may be a symbol, or any generalized variable allowed by `setf'."
- (if (not (memq nil (mapcar 'symbolp (butlast (cons place args)))))
- (list* 'prog1 place
- (let ((sets nil))
- (while args
- (cl-push (list 'setq place (car args)) sets)
- (setq place (cl-pop args)))
- (nreverse sets)))
- (let* ((places (reverse (cons place args)))
- (form (cl-pop places)))
- (while places
- (let ((method (cl-setf-do-modify (cl-pop places) 'unsafe)))
- (setq form (list 'let* (car method)
- (list 'prog1 (nth 2 method)
- (cl-setf-do-store (nth 1 method) form))))))
- form)))
+ (cond
+ ((null args) place)
+ ((symbolp place) `(prog1 ,place (setq ,place (shiftf ,@args))))
+ (t
+ (let ((method (cl-setf-do-modify place 'unsafe)))
+ `(let* ,(car method)
+ (prog1 ,(nth 2 method)
+ ,(cl-setf-do-store (nth 1 method) `(shiftf ,@args))))))))
(defmacro rotatef (&rest args)
"(rotatef PLACE...): rotate left among PLACEs.
rargs)))))))
(defmacro define-modify-macro (name arglist func &optional doc)
- "(define-modify-macro NAME ARGLIST FUNC): define a `setf'-like modify macro.
+ "Define a `setf'-like modify macro.
If NAME is called, it combines its PLACE argument with the other arguments
from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)"
(if (memq '&key arglist) (error "&key not allowed in define-modify-macro"))
(tag (intern (format "cl-struct-%s" name)))
(tag-symbol (intern (format "cl-struct-%s-tags" name)))
(include-descs nil)
- (include-tag-symbol nil)
(side-eff nil)
(type nil)
(named nil)
(while opts
(let ((opt (if (consp (car opts)) (caar opts) (car opts)))
(args (cdr-safe (cl-pop opts))))
- (cond ((eq opt ':conc-name)
+ (cond ((eq opt :conc-name)
(if args
(setq conc-name (if (car args)
(symbol-name (car args)) ""))))
- ((eq opt ':constructor)
+ ((eq opt :constructor)
(if (cdr args)
(cl-push args constrs)
(if args (setq constructor (car args)))))
- ((eq opt ':copier)
+ ((eq opt :copier)
(if args (setq copier (car args))))
- ((eq opt ':predicate)
+ ((eq opt :predicate)
(if args (setq predicate (car args))))
- ((eq opt ':include)
+ ((eq opt :include)
(setq include (car args)
include-descs (mapcar (function
(lambda (x)
(if (consp x) x (list x))))
- (cdr args))
- include-tag-symbol (intern (format "cl-struct-%s-tags"
- include))))
- ((eq opt ':print-function)
+ (cdr args))))
+ ((eq opt :print-function)
(setq print-func (car args)))
- ((eq opt ':type)
+ ((eq opt :type)
(setq type (car args)))
- ((eq opt ':named)
+ ((eq opt :named)
(setq named t))
- ((eq opt ':initial-offset)
+ ((eq opt :initial-offset)
(setq descs (nconc (make-list (car args) '(cl-skip-slot))
descs)))
(t
type (car inc-type)
named (assq 'cl-tag-slot descs))
(if (cadr inc-type) (setq tag name named t))
- (cl-push (list 'pushnew (list 'quote tag) include-tag-symbol)
- forms))
+ (let ((incl include))
+ (while incl
+ (cl-push (list 'pushnew (list 'quote tag)
+ (intern (format "cl-struct-%s-tags" incl)))
+ forms)
+ (setq incl (get incl 'cl-struct-include)))))
(if type
(progn
(or (memq type '(vector list))
(list 'nth pos 'cl-x)))))) forms)
(cl-push (cons accessor t) side-eff)
(cl-push (list 'define-setf-method accessor '(cl-x)
- (if (cadr (memq ':read-only (cddr desc)))
+ (if (cadr (memq :read-only (cddr desc)))
(list 'error (format "%s is a read-only slot"
accessor))
(list 'cl-struct-setf-expander 'cl-x
(list 'quote descs))
(list 'put (list 'quote name) '(quote cl-struct-type)
(list 'quote (list type (eq named t))))
+ (list 'put (list 'quote name) '(quote cl-struct-include)
+ (list 'quote include))
(list 'put (list 'quote name) '(quote cl-struct-print)
print-auto)
(mapcar (function (lambda (x)
;;; Types and assertions.
-(defmacro deftype (name args &rest body)
- "(deftype NAME ARGLIST BODY...): define NAME as a new data type.
+(defmacro deftype (name arglist &rest body)
+ "Define NAME as a new data type.
The type name can then be used in `typecase', `check-type', etc."
(list 'eval-when '(compile load eval)
(cl-transform-function-property
- name 'cl-deftype-handler (cons (list* '&cl-defs ''('*) args) body))))
+ name 'cl-deftype-handler (cons (list* '&cl-defs ''('*) arglist) body))))
(defun cl-make-type-test (val type)
- (if (memq type '(character string-char)) (setq type '(integer 0 255)))
(if (symbolp type)
(cond ((get type 'cl-deftype-handler)
(cl-make-type-test val (funcall (get type 'cl-deftype-handler))))
((memq type '(nil t)) type)
- ((eq type 'null) (list 'null val))
- ((eq type 'float) (list 'floatp-safe val))
- ((eq type 'real) (list 'numberp val))
- ((eq type 'fixnum) (list 'integerp val))
+ ((eq type 'null) `(null ,val))
+ ((eq type 'float) `(floatp-safe ,val))
+ ((eq type 'real) `(numberp ,val))
+ ((eq type 'fixnum) `(integerp ,val))
+ ;; FIXME: Should `character' accept things like ?\C-\M-a ? -stef
+ ((memq type '(character string-char)) `(char-valid-p ,val))
(t
(let* ((name (symbol-name type))
(namep (intern (concat name "p"))))
(cond ((get (car type) 'cl-deftype-handler)
(cl-make-type-test val (apply (get (car type) 'cl-deftype-handler)
(cdr type))))
- ((memq (car-safe type) '(integer float real number))
- (delq t (list 'and (cl-make-type-test val (car type))
+ ((memq (car type) '(integer float real number))
+ (delq t (and (cl-make-type-test val (car type))
(if (memq (cadr type) '(* nil)) t
(if (consp (cadr type)) (list '> val (caadr type))
(list '>= val (cadr type))))
(if (memq (caddr type) '(* nil)) t
(if (consp (caddr type)) (list '< val (caaddr type))
(list '<= val (caddr type)))))))
- ((memq (car-safe type) '(and or not))
+ ((memq (car type) '(and or not))
(cons (car type)
(mapcar (function (lambda (x) (cl-make-type-test val x)))
(cdr type))))
- ((memq (car-safe type) '(member member*))
+ ((memq (car type) '(member member*))
(list 'and (list 'member* val (list 'quote (cdr type))) t))
- ((eq (car-safe type) 'satisfies) (list (cadr type) val))
+ ((eq (car type) 'satisfies) (list (cadr type) val))
(t (error "Bad type spec: %s" type)))))
(defun typep (val type) ; See compiler macro below.
(defmacro ignore-errors (&rest body)
"Execute FORMS; if an error occurs, return nil.
Otherwise, return result of last FORM."
- (let ((err (gensym)))
- (list 'condition-case err (cons 'progn body) '(error nil))))
+ `(condition-case nil (progn ,@body) (error nil)))
;;; Some predicates for analyzing Lisp forms. These are used by various
v)
(if (eq x (car v)) (cdr v) '(t)))))
-;;; Count number of times X refers to Y. Return NIL for 0 times.
+;;; Count number of times X refers to Y. Return nil for 0 times.
(defun cl-expr-contains (x y)
(cond ((equal y x) 1)
((and (consp x) (not (memq (car-safe x) '(quote function function*))))
;;; Compiler macros.
(defmacro define-compiler-macro (func args &rest body)
- "(define-compiler-macro FUNC ARGLIST BODY...): Define a compiler-only macro.
+ "Define a compiler-only macro.
This is like `defmacro', but macro expansion occurs only if the call to
FUNC is compiled (i.e., not interpreted). Compiler macros should be used
for optimizing the way calls to FUNC are compiled; the form returned by
possible. Unlike regular macros, BODY can decide to \"punt\" and leave the
original function call alone by declaring an initial `&whole foo' parameter
and then returning foo."
- (let ((p (if (listp args) args (list '&rest args))) (res nil))
+ (let ((p args) (res nil))
(while (consp p) (cl-push (cl-pop p) res))
- (setq args (nreverse res)) (setcdr res (and p (list '&rest p))))
+ (setq args (nconc (nreverse res) (and p (list '&rest p)))))
(list 'eval-when '(compile load eval)
(cl-transform-function-property
func 'cl-compiler-macro
(t form)))
(define-compiler-macro member* (&whole form a list &rest keys)
- (let ((test (and (= (length keys) 2) (eq (car keys) ':test)
+ (let ((test (and (= (length keys) 2) (eq (car keys) :test)
(cl-const-expr-val (nth 1 keys)))))
(cond ((eq test 'eq) (list 'memq a list))
((eq test 'equal) (list 'member a list))
(t form))))
(define-compiler-macro assoc* (&whole form a list &rest keys)
- (let ((test (and (= (length keys) 2) (eq (car keys) ':test)
+ (let ((test (and (= (length keys) 2) (eq (car keys) :test)
(cl-const-expr-val (nth 1 keys)))))
(cond ((eq test 'eq) (list 'assq a list))
((eq test 'equal) (list 'assoc a list))
(define-compiler-macro adjoin (&whole form a list &rest keys)
(if (and (cl-simple-expr-p a) (cl-simple-expr-p list)
- (not (memq ':key keys)))
+ (not (memq :key keys)))
(list 'if (list* 'member* a list keys) list (list 'cons a list))
form))
(fifth 'nth 4 x) (sixth 'nth 5 x) (seventh 'nth 6 x)
(eighth 'nth 7 x) (ninth 'nth 8 x) (tenth 'nth 9 x)
(rest 'cdr x) (endp 'null x) (plusp '> x 0) (minusp '< x 0)
- (caar car car) (cadr car cdr) (cdar cdr car) (cddr cdr cdr)
(caaar car caar) (caadr car cadr) (cadar car cdar)
(caddr car cddr) (cdaar cdr caar) (cdadr cdr cadr)
(cddar cdr cdar) (cdddr cdr cddr) (caaaar car caaar)
;;; Things that are side-effect-free.
(mapcar (function (lambda (x) (put x 'side-effect-free t)))
- '(oddp evenp abs expt signum last butlast ldiff pairlis gcd lcm
+ '(oddp evenp signum last butlast ldiff pairlis gcd lcm
isqrt floor* ceiling* truncate* round* mod* rem* subseq
- list-length get* getf gethash hash-table-count))
+ list-length get* getf))
;;; Things that are side-effect-and-error-free.
(mapcar (function (lambda (x) (put x 'side-effect-free 'error-free)))
'(eql floatp-safe list* subst acons equalp random-state-p
- copy-tree sublis hash-table-p))
+ copy-tree sublis))
(run-hooks 'cl-macs-load-hook)