sublis: take sanity check out of recursive function
authorAlfredo Beaumont <alfredo.beaumont@gmail.com>
Sun, 12 May 2013 11:59:17 +0000 (13:59 +0200)
committerAlfredo Beaumont <alfredo.beaumont@gmail.com>
Sun, 12 May 2013 11:59:17 +0000 (13:59 +0200)
src/list.lisp

index 45aee57..9a445db 100644 (file)
 (defun cddddr (x) (cdr (cdddr x)))
 
 (defun sublis (alist tree &key key (test #'eql testp) (test-not #'eql test-not-p))
+  (when (and testp test-not-p)
+    (error "Both test and test-not are set"))
   (labels ((s (tree)
-             (when (and testp test-not-p)
-               (error "Both test and test-not are set"))
              (let* ((key-val (if key (funcall key tree) tree))
                     (replace (if test-not-p
                                  (assoc key-val alist :test-not test-not)