From: Strigoides Date: Fri, 26 Apr 2013 20:13:14 +0000 (+1200) Subject: Refactor SUBST to use COND X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=24cc0831844f88e223ce2e5ff8bb5a0b9621c026;p=jscl.git Refactor SUBST to use COND --- diff --git a/src/list.lisp b/src/list.lisp index fd6b5d3..f1d5afb 100644 --- a/src/list.lisp +++ b/src/list.lisp @@ -47,9 +47,10 @@ tree)) (defun subst (new old tree &key (key #'identity) (test #'eql)) - (if (funcall test (funcall key tree) (funcall key old)) - new - (if (consp tree) - (cons (subst new old (car tree) :key key :test test) - (subst new old (cdr tree) :key key :test test)) - tree))) + (cond + ((funcall test (funcall key tree) (funcall key old)) + new) + ((consp tree) + (cons (subst new old (car tree) :key key :test test) + (subst new old (cdr tree) :key key :test test))) + (t tree)))