projects
/
jscl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5b4edf8
)
LAST and BUTLAST work for improper lists
author
David Vazquez
<davazp@gmail.com>
Fri, 28 Dec 2012 01:37:07 +0000
(
01:37
+0000)
committer
David Vazquez
<davazp@gmail.com>
Fri, 28 Dec 2012 01:37:07 +0000
(
01:37
+0000)
lispstrack.lisp
patch
|
blob
|
history
diff --git
a/lispstrack.lisp
b/lispstrack.lisp
index
5b71994
..
562f004
100644
(file)
--- a/
lispstrack.lisp
+++ b/
lispstrack.lisp
@@
-273,14
+273,13
@@
(t (nth (1- n) (cdr list)))))
(defun last (x)
- (if (null (cdr x))
- x
- (last (cdr x))))
+ (if (consp (cdr x))
+ (last (cdr x))
+ x))
(defun butlast (x)
- (if (null (cdr x))
- nil
- (cons (car x) (butlast (cdr x)))))
+ (and (consp (cdr x))
+ (cons (car x) (butlast (cdr x)))))
(defun member (x list)
(cond