Mercurial > hg > xemacs-beta
diff lisp/cl.el @ 5448:89331fa1c819
Merged with trunk.
author | Mats Lidell <matsl@xemacs.org> |
---|---|
date | Thu, 06 Jan 2011 00:35:22 +0100 |
parents | 6506fcb40fcf d1b17a33450b |
children | 0af042a0c116 |
line wrap: on
line diff
--- a/lisp/cl.el Fri Dec 31 01:09:41 2010 +0100 +++ b/lisp/cl.el Thu Jan 06 00:35:22 2011 +0100 @@ -555,36 +555,6 @@ (defalias 'cl-round 'round*) (defalias 'cl-mod 'mod*) -(defun adjoin (cl-item cl-list &rest cl-keys) ; See compiler macro in cl-macs - "Return ITEM consed onto the front of LIST only if it's not already there. -Otherwise, return LIST unmodified. -Keywords supported: :test :test-not :key -See `member*' for the meaning of :test, :test-not and :key." - (cond ((or (equal cl-keys '(:test eq)) - (and (null cl-keys) (not (numberp cl-item)))) - (if (memq cl-item cl-list) cl-list (cons cl-item cl-list))) - ((or (equal cl-keys '(:test equal)) (null cl-keys)) - (if (member cl-item cl-list) cl-list (cons cl-item cl-list))) - (t (apply 'cl-adjoin cl-item cl-list cl-keys)))) - -(defun subst (cl-new cl-old cl-tree &rest cl-keys) - "Substitute NEW for OLD everywhere in TREE (non-destructively). -Return a copy of TREE with all elements `eql' to OLD replaced by NEW. -Keywords supported: :test :test-not :key -See `member*' for the meaning of :test, :test-not and :key." - (if (or cl-keys (and (numberp cl-old) (not (fixnump cl-old)))) - (apply 'sublis (list (cons cl-old cl-new)) cl-tree cl-keys) - (cl-do-subst cl-new cl-old cl-tree))) - -(defun cl-do-subst (cl-new cl-old cl-tree) - (cond ((eq cl-tree cl-old) cl-new) - ((consp cl-tree) - (let ((a (cl-do-subst cl-new cl-old (car cl-tree))) - (d (cl-do-subst cl-new cl-old (cdr cl-tree)))) - (if (and (eq a (car cl-tree)) (eq d (cdr cl-tree))) - cl-tree (cons a d)))) - (t cl-tree))) - (defun acons (key value alist) "Return a new alist created by adding (KEY . VALUE) to ALIST." (cons (cons key value) alist))