From: yamaoka Date: Fri, 10 Dec 1999 08:38:55 +0000 (+0000) Subject: (union): New compiler macro for emulating cl function. X-Git-Tag: t-gnus-6_14_0-07 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62fa081706fb82b151527aad0a4edf0e064852bc;p=elisp%2Fgnus.git- (union): New compiler macro for emulating cl function. --- diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index 8aec2e5..e4cf885 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -113,6 +113,24 @@ (setq arg (cdr arg))) (apply (function nconc) (nreverse res)))))) +(define-compiler-macro union (&whole form list1 list2) + (if (and (fboundp 'union) + (subrp (symbol-function 'union))) + form + `(let ((a ,list1) + (b ,list2)) + (cond ((null a) b) + ((null b) a) + ((equal a b) a) + (t + (or (>= (length a) (length b)) + (setq a (prog1 b (setq b a)))) + (while b + (or (memq (car b) a) + (push (car b) a)) + (pop b)) + a))))) + ;; If we are building w3 in a different directory than the source ;; directory, we must read *.el from source directory and write *.elc ;; into the building directory. For that, we define this function