;; Here's a little trick I just discovered. Dunno how portable it is. ;; ;; I often would like to write code like: ;; ;; (if <complicated-test> ;; (defun foo () <version1>) ;; (defun foo () <version2>)) ;; ;; The drawback of this idiom is that FOO is no longer at toplevel. ;; If we write ;; ;; #+<complicated-test> ;; (defun foo () <version1>) ;; #-<complicated-test> ;; (defun foo () <version2>) ;; ;; FOO would be at toplevel, but <complicated-test> can only contain ;; simple feature expressions. ;; ;; But if we write ;; ;; #+#.(if <complicated-test> '(and) '(or)) ;; (defun foo () <version1>) ;; #-#.(if <complicated-test> '(and) '(or)) ;; (defun foo () <version2>) ;; ;; we get the advantages of both variants.
;; Define ASSQ unless it is already defined:
#+#.(cl:if (cl:fboundp 'cl-user::assq) '(or) '(and)) (defun assq (item list) (assoc item list :test #'eq))