projects
/
jscl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
47634cb
)
Refactor SUBST to use COND
author
Strigoides
<Strigoides@gmail.com>
Fri, 26 Apr 2013 20:13:14 +0000
(08:13 +1200)
committer
Strigoides
<Strigoides@gmail.com>
Fri, 26 Apr 2013 20:13:14 +0000
(08:13 +1200)
src/list.lisp
patch
|
blob
|
history
diff --git
a/src/list.lisp
b/src/list.lisp
index
fd6b5d3
..
f1d5afb
100644
(file)
--- a/
src/list.lisp
+++ b/
src/list.lisp
@@
-47,9
+47,10
@@
tree))
(defun subst (new old tree &key (key #'identity) (test #'eql))
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)))