From 24cc0831844f88e223ce2e5ff8bb5a0b9621c026 Mon Sep 17 00:00:00 2001 From: Strigoides Date: Sat, 27 Apr 2013 08:13:14 +1200 Subject: [PATCH] Refactor SUBST to use COND --- src/list.lisp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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))) -- 1.7.10.4